diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2025-12-13 02:25:51 +0100 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2025-12-13 02:25:51 +0100 |
| commit | 79ad58e62fc1a76a55e350a04aa5b88be41c2370 (patch) | |
| tree | d451005a1c1cc98594a438c55c2edc83f1d850d1 | |
| parent | 884d170e8a75db282bee3db04fed60d57139d775 (diff) | |
| download | challe-anka-79ad58e62fc1a76a55e350a04aa5b88be41c2370.tar.gz | |
Move archived forums to the archive category, if one exists
| -rw-r--r-- | commands.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/commands.ts b/commands.ts index cb3158a..311d54c 100644 --- a/commands.ts +++ b/commands.ts @@ -151,6 +151,15 @@ async function archiveCtf(interaction: ChatInputCommandInteraction) { .map(overwrite => forum.permissionOverwrites.delete(overwrite.id)) ); + let channels = await interaction.guild.channels.fetch(); + let archiveCategory = channels.find( + channel => channel?.type === ChannelType.GuildCategory && ["Archive", "archive"].includes(channel.name) + ); + + if (archiveCategory) { + await forum.setParent(archiveCategory.id, { lockPermissions: false }); + } + await interaction.reply({ content: `Updated ${forum.name}: @everyone can read, (mostly) no-one can write.`, flags: "Ephemeral", @@ -258,7 +267,7 @@ async function handleJoinCtfButton(interaction: ButtonInteraction, forumId: stri }); await interaction.reply({ - content: `Granted you access to ${forumChannel.name}.`, + content: `Granted you access to https://discord.com/channels/${interaction.guild.id}/${forumChannel.id}`, flags: "Ephemeral", }); } |
