diff --git a/src/slashCommands/_commands.ts b/src/slashCommands/_commands.ts index c6e73b5..c31739a 100644 --- a/src/slashCommands/_commands.ts +++ b/src/slashCommands/_commands.ts @@ -1,6 +1,7 @@ import {ApplicationCommandData, Interaction} from 'discord.js'; import settingsCommand from './settings.command'; import voiceCommand from './voice.command'; +import infoCommand from './info.command'; export interface DDCommand { commandData: ApplicationCommandData; @@ -11,4 +12,5 @@ export interface DDCommand { export default [ voiceCommand, settingsCommand, + infoCommand, ] as DDCommand[]; diff --git a/src/slashCommands/info.command.ts b/src/slashCommands/info.command.ts new file mode 100644 index 0000000..cbcbecf --- /dev/null +++ b/src/slashCommands/info.command.ts @@ -0,0 +1,43 @@ +import { + ApplicationCommandData, + ApplicationCommandType, + ChatInputCommandInteraction, + PermissionsBitField, + EmbedBuilder, +} from 'discord.js'; +import {logger} from '../logger'; +import {DDCommand} from './_commands'; + + +export default { + commandData: { + type: ApplicationCommandType.ChatInput, + name: 'info', + description: + 'View general information and recent statistics for the ' + + 'Dynamic Voices bot', + dmPermission: false, + defaultMemberPermissions: PermissionsBitField.Flags.ManageGuild, + options: [], + } as ApplicationCommandData, + + commandExecutor: async (interaction: ChatInputCommandInteraction) => { + if (interaction.commandName !== 'info') { + logger.error( + `Interaction '${interaction.commandName}' got thrown into handler ` + + 'for \'info\'!', + ); + logger.error(Error().stack); + } + + await interaction.deferReply({ephemeral: true}); + + const infoEmbed = new EmbedBuilder() + .setColor([1, 1, 1]) + .setTitle('Dynamic Voices bot information') + .addFields({name: 'Test', value: 'testvalue', inline: true}) + .toJSON(); + + await interaction.editReply({embeds: [infoEmbed]}); + }, +} as DDCommand;