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