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