feat: simpler non-user error messaging

This commit is contained in:
TrèsAbhi committed 2023-10-31 11:56:06 -05:00
1 parent 44f03a1fce
commit d1ebb79432
1 file changed
+20 -6
@@ -47,25 +47,39 @@ export default async function handleChatInputCommand(
await interaction.editReply(reply); await interaction.editReply(reply);
} catch (error) { } catch (error) {
const actionRow = new ActionRowBuilder<ButtonBuilder>().addComponents( const components = [
new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder() new ButtonBuilder()
.setLabel('Get Help on Discord Server') .setLabel('Get Help on Discord Server')
.setURL('https://discord.gg/nDt7AjGJQH') .setURL('https://discord.gg/nDt7AjGJQH')
.setStyle(ButtonStyle.Link), .setStyle(ButtonStyle.Link),
); ),
];
if (!(error instanceof UserError)) { if (!(error instanceof UserError)) {
console.error(interaction.commandName, error); console.error(interaction.commandName, error);
}
await interaction.editReply({ interaction.editReply({
embeds: [ embeds: [
embedNegative( embedNegative(
(error as Error).message, (error as Error).message,
`${(error as Error).cause ?? 'No further information is available.'}`, `${
(error as Error).cause ?? 'No further information is available.'
}`,
), ),
], ],
components: [actionRow], 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,
}); });
} }
} }
}