client.on("messageCreate", async (message) => {
if (message.content.startsWith("!addTag")) {
const channelIdToCopy = message.content.split(" ")[1];
const tagName = "Help Needed";
const tagEmoji = "❗";
try {
const forumChannel = await client.channels.fetch(channelIdToCopy);
if (!forumChannel || forumChannel.type !== ChannelType.GuildForum) {
message.channel.send("Invalid or non-forum channel ID provided.");
return;
}
const updatedTags = [
...forumChannel.availableTags,
{ name: tagName, emoji: tagEmoji },
];
await forumChannel.edit({ availableTags: updatedTags });
} catch (error) {
console.error("Error adding tag with emoji:", error);
message.channel.send(
"An error occurred while adding the tag with emoji."
);
}
}
});
client.on("messageCreate", async (message) => {
if (message.content.startsWith("!addTag")) {
const channelIdToCopy = message.content.split(" ")[1];
const tagName = "Help Needed";
const tagEmoji = "❗";
try {
const forumChannel = await client.channels.fetch(channelIdToCopy);
if (!forumChannel || forumChannel.type !== ChannelType.GuildForum) {
message.channel.send("Invalid or non-forum channel ID provided.");
return;
}
const updatedTags = [
...forumChannel.availableTags,
{ name: tagName, emoji: tagEmoji },
];
await forumChannel.edit({ availableTags: updatedTags });
} catch (error) {
console.error("Error adding tag with emoji:", error);
message.channel.send(
"An error occurred while adding the tag with emoji."
);
}
}
});