summaryrefslogtreecommitdiff
path: root/commands.ts
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2026-01-17 00:52:39 +0100
committerMathias Magnusson <mathias@magnusson.space>2026-01-17 00:52:39 +0100
commit3eb6e7729c2fb5461b3f04d5f496084f18906e41 (patch)
tree77e57ceedcd5a1142b372b5f3c9ca5a2b0e619a7 /commands.ts
parent79ad58e62fc1a76a55e350a04aa5b88be41c2370 (diff)
downloadchalle-anka-3eb6e7729c2fb5461b3f04d5f496084f18906e41.tar.gz
add command to re-create join button
Diffstat (limited to 'commands.ts')
-rw-r--r--commands.ts32
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({