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
+30 -16
@@ -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 ButtonBuilder() new ActionRowBuilder<ButtonBuilder>().addComponents(
.setLabel('Get Help on Discord Server') new ButtonBuilder()
.setURL('https://discord.gg/nDt7AjGJQH') .setLabel('Get Help on Discord Server')
.setStyle(ButtonStyle.Link), .setURL('https://discord.gg/nDt7AjGJQH')
); .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,
});
}
} }
} }