threadUpdate

Code:
if (newThread.parentId === '1083539122083352589') {
if (!oldThread.appliedTags.includes('1083616112060661892') && newThread.appliedTags.includes('1083616112060661892')) {
await newThread.send('This thread has been marked as solved.\n The thread will be closed shortly.');
await wait(5000);
await newThread.setArchived(true);
}
}
if (newThread.parentId === '1083539122083352589') {
if (oldThread.archived && !newThread.archived) {
const jsremovetag = newThread.appliedTags.filter(tag => tag !== '1083616112060661892')
await jsremovetag.setAppliedTags(jsremovetag)
await newThread.send('This thread has been opened again. Please make sure you have the correct tags on the post.\n Use </get-help:1084975333968707685> to request a coding helper.');
}
}
if (newThread.parentId === '1083539122083352589') {
if (!oldThread.appliedTags.includes('1083616112060661892') && newThread.appliedTags.includes('1083616112060661892')) {
await newThread.send('This thread has been marked as solved.\n The thread will be closed shortly.');
await wait(5000);
await newThread.setArchived(true);
}
}
if (newThread.parentId === '1083539122083352589') {
if (oldThread.archived && !newThread.archived) {
const jsremovetag = newThread.appliedTags.filter(tag => tag !== '1083616112060661892')
await jsremovetag.setAppliedTags(jsremovetag)
await newThread.send('This thread has been opened again. Please make sure you have the correct tags on the post.\n Use </get-help:1084975333968707685> to request a coding helper.');
}
}
Error:
node:events:491
+ throw er; // Unhandled 'error' event
^

8TypeError: jsremovetag.setAppliedTags is not a function
H at module.exports (/home/node/events/discord/threadUpdate.js:14:33)
( at Client.emit (node:events:513:28)
at module.exports [as THREAD_UPDATE]
node:events:491
+ throw er; // Unhandled 'error' event
^

8TypeError: jsremovetag.setAppliedTags is not a function
H at module.exports (/home/node/events/discord/threadUpdate.js:14:33)
( at Client.emit (node:events:513:28)
at module.exports [as THREAD_UPDATE]
What I Am Trying To Do: I am trying to have the bot remove a certain tag if the post is re-opened.
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
JollyJohn
JollyJohnOP2y ago
I think it was because I did jsremovetag instead of newThread 🤦
Pulse
Pulse2y ago
yeah thats definitely it
JollyJohn
JollyJohnOP2y ago
yup that was it Hi, @corysalad
node:events:491
+ throw er; // Unhandled 'error' event
^

QDiscordAPIError[40067]: A tag is required to create a forum post in this channel
node:events:491
+ throw er; // Unhandled 'error' event
^

QDiscordAPIError[40067]: A tag is required to create a forum post in this channel
If that is the only tag what should I do?
Syjalo
Syjalo2y ago
Add that tag or disable the requirement
JollyJohn
JollyJohnOP2y ago
ik, but i want to remove that tag if its reopened, is there something around that so only way is to remove teh requirement @syjalo or have another tag on it originally?
Syjalo
Syjalo2y ago
You can add another tag, yes
JollyJohn
JollyJohnOP2y ago
ok, thank
Want results from more Discord servers?
Add your server