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 User15mo ago
Message Not Public
Sign In & Join Server To View
Baconburger998
Baconburger99815mo ago
I think it was because I did jsremovetag instead of newThread 🤦
Pulse
Pulse15mo ago
yeah thats definitely it
Baconburger998
Baconburger99815mo 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
Syjalo15mo ago
Add that tag or disable the requirement
Baconburger998
Baconburger99815mo 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
Syjalo15mo ago
You can add another tag, yes
Baconburger998
Baconburger99815mo ago
ok, thank