Forum thread tag not working

Why doesn't my bot add the tag to the forum thread?
const serverId = interaction.guild.id;

const forumChannel = config[serverId].channels.forum_channel;
console.log(forumChannel);

const channel = interaction.client.channels.cache.get(forumChannel);
const tag = config[serverId].tags.forum_rollenanfrage_tag;
channel.threads.create({
name: `Rollenanfrage für ${interaction.fields.getTextInputValue('username')}, Angefragt von ${interaction.member}`,
message: {
embeds: [anfrageEmbed],
components: [ModeratorButtons],
},
appliedTags: [tag],
});
const serverId = interaction.guild.id;

const forumChannel = config[serverId].channels.forum_channel;
console.log(forumChannel);

const channel = interaction.client.channels.cache.get(forumChannel);
const tag = config[serverId].tags.forum_rollenanfrage_tag;
channel.threads.create({
name: `Rollenanfrage für ${interaction.fields.getTextInputValue('username')}, Angefragt von ${interaction.member}`,
message: {
embeds: [anfrageEmbed],
components: [ModeratorButtons],
},
appliedTags: [tag],
});
17 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers.
chewie
chewie17mo ago
whats tag log it
EndergamerMC
EndergamerMCOP17mo ago
the id of the tag 1127349012996051075 it logged 1127349012996051075 and it should work like that, right?
edocsil
edocsil17mo ago
If it's a string yeah. Find the tag from the forum availableTags and log it to make sure it's valid
EndergamerMC
EndergamerMCOP17mo ago
yes, it is a string
EndergamerMC
EndergamerMCOP17mo ago
EndergamerMC
EndergamerMCOP17mo ago
Yeah, I did that to get the id of the tag
edocsil
edocsil17mo ago
Can you please log and show it to confirm it's still valid?
EndergamerMC
EndergamerMCOP17mo ago
Sure, one sec please
edocsil
edocsil17mo ago
Also what is it doing? Creating the post but without any tags?
EndergamerMC
EndergamerMCOP17mo ago
Yeah Everything is correct but it doesn't apply the tag Here's the code with the logs:
const serverId = interaction.guild.id;
console.log(`serverId: ${serverId}`);

const forumChannel = config[serverId].channels.forum_channel;
console.log(`forumChannel: ${forumChannel}`);

const channel = interaction.client.channels.cache.get(forumChannel);
const tag = config[serverId].tags.forum_rollenanfrage_tag;
console.log(`tag: ${tag}`);
channel.threads.create({
name: `Rollenanfrage für ${interaction.fields.getTextInputValue('username')}, Angefragt von ${interaction.member}`,
message: {
embeds: [anfrageEmbed],
components: [ModeratorButtons],
},
appliedTags: [tag],
});
const serverId = interaction.guild.id;
console.log(`serverId: ${serverId}`);

const forumChannel = config[serverId].channels.forum_channel;
console.log(`forumChannel: ${forumChannel}`);

const channel = interaction.client.channels.cache.get(forumChannel);
const tag = config[serverId].tags.forum_rollenanfrage_tag;
console.log(`tag: ${tag}`);
channel.threads.create({
name: `Rollenanfrage für ${interaction.fields.getTextInputValue('username')}, Angefragt von ${interaction.member}`,
message: {
embeds: [anfrageEmbed],
components: [ModeratorButtons],
},
appliedTags: [tag],
});
And that's what gets logged:
serverId: 805758643114737676
forumChannel: 1127349012996051075
tag: 1127349012996051075
serverId: 805758643114737676
forumChannel: 1127349012996051075
tag: 1127349012996051075
edocsil
edocsil17mo ago
const tagObject = channel.availableTags.find(t => t.id === tag)
console.log(tagObject)
const tagObject = channel.availableTags.find(t => t.id === tag)
console.log(tagObject)
EndergamerMC
EndergamerMCOP17mo ago
When I run this, the tagObject is undefined
edocsil
edocsil17mo ago
Then there's no tag with that ID in the forum channel console.log(channel.availableTags)
EndergamerMC
EndergamerMCOP17mo ago
But it shows up:
serverId: 805758643114737676
forumChannel: 1127349012996051075
tag: 1127349012996051075
undefined
[
{
id: '1128766940836532255',
name: 'Rollenanfrage',
moderated: false,
emoji: null
}
]
serverId: 805758643114737676
forumChannel: 1127349012996051075
tag: 1127349012996051075
undefined
[
{
id: '1128766940836532255',
name: 'Rollenanfrage',
moderated: false,
emoji: null
}
]
huh the tag id changed can it change by itself?
edocsil
edocsil17mo ago
Copied the wrong thing or it was deleted and recreated
EndergamerMC
EndergamerMCOP17mo ago
Ohh, thank you very much!
Want results from more Discord servers?
Add your server