From 3eb6e7729c2fb5461b3f04d5f496084f18906e41 Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Sat, 17 Jan 2026 00:52:39 +0100 Subject: add command to re-create join button --- commands.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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, @@ -31,6 +32,18 @@ export let slashCommands = [ ), handler: newCtf, }, + { + 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") @@ -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().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({ -- cgit v1.2.3