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

1 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);
      }
  }