diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2026-01-17 00:52:39 +0100 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2026-01-17 00:52:39 +0100 |
| commit | 3eb6e7729c2fb5461b3f04d5f496084f18906e41 (patch) | |
| tree | 77e57ceedcd5a1142b372b5f3c9ca5a2b0e619a7 | |
| parent | 79ad58e62fc1a76a55e350a04aa5b88be41c2370 (diff) | |
| download | challe-anka-3eb6e7729c2fb5461b3f04d5f496084f18906e41.tar.gz | |
add command to re-create join button
| -rw-r--r-- | commands.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/commands.ts b/commands.ts index 311d54c..f100cc7 100644 --- a/commands.ts +++ b/commands.ts @@ -6,6 +6,7 @@ import { ForumChannel, PermissionFlagsBits, SlashCommandBuilder, + SlashCommandChannelOption, SlashCommandStringOption, SlashCommandUserOption, type ButtonInteraction, @@ -33,6 +34,18 @@ export let slashCommands = [ }, { slashCommand: new SlashCommandBuilder() + .setName("create-button-message") + .setDescription("Re-create a message containing an invite button for this CTF") + .addChannelOption( + new SlashCommandChannelOption() + .setName("channel") + .setDescription("The channel in which to create the button") + .setRequired(true) + ), + handler: createButtonMessage, + }, + { + slashCommand: new SlashCommandBuilder() .setName("archive") .setDescription("Make this CTF forum read-only for everyone"), handler: archiveCtf, @@ -124,6 +137,25 @@ async function newCtf(interaction: ChatInputCommandInteraction) { ); } +async function createButtonMessage(interaction: ChatInputCommandInteraction) { + let forum = await getCtfForum(interaction); + + let channel = interaction.options.getChannel("channel", true, [ChannelType.GuildText]); + + await channel.send({ + components: [ + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder() + .setCustomId(`${buttonCommands.join.prefix}${forum.id}`) + .setLabel(`Join ${forum.name}`) + .setStyle(ButtonStyle.Primary), + ), + ], + }); + + await interaction.reply({ content: "Done!", flags: "Ephemeral" }); +} + async function archiveCtf(interaction: ChatInputCommandInteraction) { if (!interaction.guild) { await interaction.reply({ |
