#threadUpdate

15 messages · Page 1 of 1 (latest)

mortal schooner
#

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.');  
          }
          }

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] 

What I Am Trying To Do:
I am trying to have the bot remove a certain tag if the post is re-opened.

tawdry maple
#

• 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.

mortal schooner
#

I think it was because I did jsremovetag instead of newThread 🤦

open karma
#

yeah thats definitely it

mortal schooner
#

yup that was it

mortal schooner
#

Hi,

#

@open karma

#
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?

raven bloom
#

Add that tag or disable the requirement

mortal schooner
#

ik, but i want to remove that tag if its reopened, is there something around that

#

so only way is to remove teh requirement

#

@raven bloom

#

or have another tag on it originally?

raven bloom
#

You can add another tag, yes