Skip to content

Commit

Permalink
Fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
S222em committed Jan 9, 2022
1 parent 94277fc commit 8de75c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
12 changes: 5 additions & 7 deletions src/handlers/ComponentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 5 additions & 7 deletions src/handlers/InteractionCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/MessageCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
});
Expand Down

0 comments on commit 8de75c2

Please sign in to comment.