diff --git a/src/commands.ts b/src/commands.ts index d09e99b..f0bbcc1 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -4,6 +4,11 @@ export const voiceOnDemandCommand = new SlashCommandBuilder() .setName('voice-on-demand') .setDescription('Actions related to the voice lobby') .addSubcommand((subcommand) => - subcommand.setName('create').setDescription('Creates the voice lobby') + subcommand.setName('create').setDescription('Creates the voice lobby'), ) .toJSON(); + +export const fartCommand = new SlashCommandBuilder() + .setName('fart') + .setDescription("Replies with https://prout.dev") + .toJSON(); diff --git a/src/handlers/handle-interaction-creation.ts b/src/handlers/handle-interaction-creation.ts index be605c5..21ac505 100644 --- a/src/handlers/handle-interaction-creation.ts +++ b/src/handlers/handle-interaction-creation.ts @@ -7,15 +7,21 @@ export const handleInteractionCreation = async (interaction: Interaction): Promi !interaction.isCommand() || !interaction.inGuild() || !interaction.isChatInputCommand() || - interaction.commandName !== 'voice-on-demand' + !['voice-on-demand', 'fart'].includes(interaction.commandName) ) { return; } - if (interaction.options.getSubcommand(true) !== 'create') { - await interaction.reply('Unknown subcommand'); - return; + switch (interaction.commandName) { + case 'voice-on-demand': + if (interaction.options.getSubcommand(true) !== 'create') { + await interaction.reply('Unknown subcommand'); + return; + } + await createLobby(interaction); + break; + case 'fart': + await interaction.reply('https://prout.dev'); + break; } - - await createLobby(interaction); }; diff --git a/src/main.ts b/src/main.ts index b8f23bc..15b29a0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { Client, REST, Routes } from 'discord.js'; -import { voiceOnDemandCommand } from './commands'; +import { fartCommand, voiceOnDemandCommand } from './commands'; import { config } from './config'; import { deleteExistingCommands } from './delete-existing-commands'; import { handleGuildMessageCreation } from './handlers/handle-guild-message-creation'; @@ -51,7 +51,7 @@ const rest = new REST({ version: '10' }).setToken(discord.token); await deleteExistingCommands(rest, discord); await rest.put(Routes.applicationGuildCommands(discord.clientId, discord.guildId), { - body: [voiceOnDemandCommand], + body: [voiceOnDemandCommand, fartCommand], }); console.log('Bot started.');