I watched "https://discordjs.guide/popular-topics/faq.html#how-do-i-create-a-post-in-a-forum-channel" which mentioned that the way to obtain Tag is to use ForumChannel#availableTags
But I have been unable to get the tags when adding a new forum. Below is my sample code.
discord.on('threadCreate', async (thread) => {
const cache = discord.channels.cache.find((channel) => channel.id === thread.id);
console.log(thread.guild.channels.guild);
});
How do I get the tag?
Use ThreadChannel#appliedTags.
discord.on('threadCreate', async (thread) => {
if (!(thread.parent instanceof ForumChannel)) {
console.log("Not a forum channel");
}
console.log("tags:", thread.appliedTags.map(s => thread.parent.availableTags.find(t => t.id === s)).map(x => x.name).join(","));
});