mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: user error now results in user friendly message
This commit is contained in:
1 parent
dfba8bd15f
commit
d991be4934
1 file changed
+7
-8
@@ -20,7 +20,6 @@ export default async function handleChatInputCommand(
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
try {
|
||||
if (registry.inPreview && interaction.guildId !== discord.tres_guild_id) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
@@ -34,6 +33,7 @@ export default async function handleChatInputCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const returnable = await registry.handler(interaction);
|
||||
|
||||
if (registry.handlesInteraction) return;
|
||||
@@ -56,21 +56,20 @@ export default async function handleChatInputCommand(
|
||||
),
|
||||
];
|
||||
|
||||
if (!(error instanceof UserError)) {
|
||||
console.error(interaction.commandName, error);
|
||||
|
||||
if (error instanceof UserError) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
embedNegative(
|
||||
(error as Error).message,
|
||||
`${
|
||||
(error as Error).cause ?? 'No further information is available.'
|
||||
}`,
|
||||
error.message,
|
||||
(error.cause as string | undefined) ??
|
||||
'No further information is available.',
|
||||
),
|
||||
],
|
||||
components,
|
||||
});
|
||||
} else {
|
||||
console.error(interaction.commandName, error);
|
||||
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
embedNegative(
|
||||
|
||||
Reference in new issue
Block a user