#How would I go about getting the currently applied tags in a Forums channel?

4 messages · Page 1 of 1 (latest)

unkempt scarab
#

I tries this and kept getting Failed to change thread tags: TypeError: Cannot read properties of undefined (reading 'fetch')

try {
          if (member.roles.cache.has(botRoleId)) {
              return;
          }

          const currentTags = await thread.tags.fetch();
          const currentTagIds = currentTags.map(tag => tag.id);

          if (member.roles.cache.has(supportRoleId)) {
              if (!currentTagIds.includes(staffResponseTag)) {
                  await thread.setArchived(false);
                  await thread.setAppliedTags([staffResponseTag]);
              }
          } else {
              if (!currentTagIds.includes(creatorResponseTag)) {
                  await thread.setArchived(false);
                  await thread.setAppliedTags([creatorResponseTag]);
              }
          }
      } catch (error) {
          console.error('Failed to change thread tags:', error);
      }
  }
twilit cosmosBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
summer ermineBOT
light canyon
#

there's no need to fetch them, they're sent with the thread channel