From ca475356ad95fec86e8e8b5bf4bbf17b70add5fe Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Tue, 2 Apr 2024 19:47:30 +0700 Subject: [PATCH] feat(bots/discord/commands): allow process exception in `exception-test` --- bots/discord/src/commands/development/exception-test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bots/discord/src/commands/development/exception-test.ts b/bots/discord/src/commands/development/exception-test.ts index 038b17a..fb9440a 100644 --- a/bots/discord/src/commands/development/exception-test.ts +++ b/bots/discord/src/commands/development/exception-test.ts @@ -11,6 +11,10 @@ export default { option .setName('type') .setDescription('The type of exception to throw') + .addChoices({ + name: 'process exception', + value: 'Process', + }) .addChoices({ name: 'generic error', value: 'Generic', @@ -36,10 +40,12 @@ export default { .setDMPermission(true) .toJSON(), + ownerOnly: true, global: true, async execute(_, interaction) { const type = interaction.options.getString('type', true) - throw new CommandError(CommandErrorType[type as keyof typeof CommandErrorType], '[INTENTIONAL BOT DESIGN]') + if (type === 'Process') throw new Error('Intentional process exception') + throw new CommandError(CommandErrorType[type as keyof typeof CommandErrorType], 'Intentional bot design') // ;) }, } satisfies Command