Skip to content

Commit 8de75c2

Browse files
committed
Fix eslint
1 parent 94277fc commit 8de75c2

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/handlers/ComponentHandler.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ export async function ComponentHandler(interaction: MessageComponentInteraction)
7373
Logger.error(error.code || '', error.message);
7474
if (error.stack) Logger.trace(error.stack);
7575
const errorReply = () =>
76-
ctx.replied || ctx.deferred
77-
? ctx.editReply(client.responses.ERROR)
78-
: ctx.reply({
79-
content: client.responses.ERROR,
80-
ephemeral: true,
81-
components: [],
82-
});
76+
ctx.safeReply({
77+
content: client.responses.ERROR,
78+
ephemeral: true,
79+
components: [],
80+
});
8381
if (typeof component.onError === 'function')
8482
await Promise.resolve(component.onError(ctx, error)).catch(async () => await errorReply());
8583
else await errorReply();

src/handlers/InteractionCommandHandler.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ export async function InteractionCommandHandler(interaction: CommandInteraction
6464
Logger.error(error.code || '', error.message);
6565
if (error.stack) Logger.trace(error.stack);
6666
const errorReply = () =>
67-
ctx.replied || ctx.deferred
68-
? ctx.editReply(client.responses.ERROR)
69-
: ctx.reply({
70-
content: client.responses.ERROR,
71-
components: [],
72-
ephemeral: true,
73-
});
67+
ctx.safeReply({
68+
content: client.responses.ERROR,
69+
components: [],
70+
ephemeral: true,
71+
});
7472

7573
if (typeof command.onError === 'function')
7674
await Promise.resolve(command.onError(ctx, error)).catch(async () => await errorReply());

src/handlers/MessageCommandHandler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export async function MessageCommandHandler(
9595
Logger.error(error.code || '', error.message);
9696
if (error.stack) Logger.trace(error.stack);
9797
const errorReply = () =>
98-
ctx.reply({
98+
ctx.safeReply({
9999
content: client.responses.ERROR,
100100
components: [],
101101
});

0 commit comments

Comments
 (0)