From d1ebb7943282d2ad2b553858d946f78e91e08f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:56:06 -0500 Subject: [PATCH] feat: simpler non-user error messaging --- .../handlers/chatInputCommand.ts | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/events/interactionCreate/handlers/chatInputCommand.ts b/src/events/interactionCreate/handlers/chatInputCommand.ts index dbe76ff67..12fabf78f 100644 --- a/src/events/interactionCreate/handlers/chatInputCommand.ts +++ b/src/events/interactionCreate/handlers/chatInputCommand.ts @@ -47,25 +47,39 @@ export default async function handleChatInputCommand( await interaction.editReply(reply); } catch (error) { - const actionRow = new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setLabel('Get Help on Discord Server') - .setURL('https://discord.gg/nDt7AjGJQH') - .setStyle(ButtonStyle.Link), - ); + const components = [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel('Get Help on Discord Server') + .setURL('https://discord.gg/nDt7AjGJQH') + .setStyle(ButtonStyle.Link), + ), + ]; if (!(error instanceof UserError)) { console.error(interaction.commandName, error); - } - await interaction.editReply({ - embeds: [ - embedNegative( - (error as Error).message, - `${(error as Error).cause ?? 'No further information is available.'}`, - ), - ], - components: [actionRow], - }); + interaction.editReply({ + embeds: [ + embedNegative( + (error as Error).message, + `${ + (error as Error).cause ?? 'No further information is available.' + }`, + ), + ], + components, + }); + } else { + interaction.editReply({ + embeds: [ + embedNegative( + 'Blitzkrieg ran into an error!', + "We're so sorry about this. Feel free to [join the official Discord server](https://discord.gg/nDt7AjGJQH) to get help.", + ), + ], + components, + }); + } } }