diff --git a/src/handlers/ComponentHandler.ts b/src/handlers/ComponentHandler.ts index e4f8846d4..ed33f8422 100644 --- a/src/handlers/ComponentHandler.ts +++ b/src/handlers/ComponentHandler.ts @@ -73,13 +73,11 @@ export async function ComponentHandler(interaction: MessageComponentInteraction) Logger.error(error.code || '', error.message); if (error.stack) Logger.trace(error.stack); const errorReply = () => - ctx.replied || ctx.deferred - ? ctx.editReply(client.responses.ERROR) - : ctx.reply({ - content: client.responses.ERROR, - ephemeral: true, - components: [], - }); + ctx.safeReply({ + content: client.responses.ERROR, + ephemeral: true, + components: [], + }); if (typeof component.onError === 'function') await Promise.resolve(component.onError(ctx, error)).catch(async () => await errorReply()); else await errorReply(); diff --git a/src/handlers/InteractionCommandHandler.ts b/src/handlers/InteractionCommandHandler.ts index fd0eed307..0b860e24f 100644 --- a/src/handlers/InteractionCommandHandler.ts +++ b/src/handlers/InteractionCommandHandler.ts @@ -64,13 +64,11 @@ export async function InteractionCommandHandler(interaction: CommandInteraction Logger.error(error.code || '', error.message); if (error.stack) Logger.trace(error.stack); const errorReply = () => - ctx.replied || ctx.deferred - ? ctx.editReply(client.responses.ERROR) - : ctx.reply({ - content: client.responses.ERROR, - components: [], - ephemeral: true, - }); + ctx.safeReply({ + content: client.responses.ERROR, + components: [], + ephemeral: true, + }); if (typeof command.onError === 'function') await Promise.resolve(command.onError(ctx, error)).catch(async () => await errorReply()); diff --git a/src/handlers/MessageCommandHandler.ts b/src/handlers/MessageCommandHandler.ts index df521586b..548053689 100644 --- a/src/handlers/MessageCommandHandler.ts +++ b/src/handlers/MessageCommandHandler.ts @@ -95,7 +95,7 @@ export async function MessageCommandHandler( Logger.error(error.code || '', error.message); if (error.stack) Logger.trace(error.stack); const errorReply = () => - ctx.reply({ + ctx.safeReply({ content: client.responses.ERROR, components: [], });