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 toolkit11mo 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 🌈
chewie 🌈11mo ago
whats tag log it
EndergamerMC
EndergamerMC11mo ago
the id of the tag 1127349012996051075 it logged 1127349012996051075 and it should work like that, right?
edocsil
edocsil11mo ago
If it's a string yeah. Find the tag from the forum availableTags and log it to make sure it's valid
EndergamerMC
EndergamerMC11mo ago
yes, it is a string
EndergamerMC
EndergamerMC11mo ago
EndergamerMC
EndergamerMC11mo ago
Yeah, I did that to get the id of the tag
edocsil
edocsil11mo ago
Can you please log and show it to confirm it's still valid?
EndergamerMC
EndergamerMC11mo ago
Sure, one sec please
edocsil
edocsil11mo ago
Also what is it doing? Creating the post but without any tags?
EndergamerMC
EndergamerMC11mo 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
edocsil11mo 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
EndergamerMC11mo ago
When I run this, the tagObject is undefined
edocsil
edocsil11mo ago
Then there's no tag with that ID in the forum channel console.log(channel.availableTags)
EndergamerMC
EndergamerMC11mo 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
edocsil11mo ago
Copied the wrong thing or it was deleted and recreated
EndergamerMC
EndergamerMC11mo ago
Ohh, thank you very much!