summaryrefslogtreecommitdiff
path: root/commands.ts
diff options
context:
space:
mode:
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({