InteractionAlreadyReplied even with catch

code:
await interaction.deferReply({ ephemeral: config.commands.leaderboard.ephemeral }).catch(() => {});
await interaction.deferReply({ ephemeral: config.commands.leaderboard.ephemeral }).catch(() => {});
When i use the leaderboard command i sometimes get this error:
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\Administrator\Downloads\StaticsBot-2.0.1 from dm\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:102:46)
at Object.run (C:\Users\Administrator\Downloads\StaticsBot-2.0.1 from dm\modules\commands\leaderboards.js:102:46)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'InteractionAlreadyReplied'
} Unhandled Rejection
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\Administrator\Downloads\StaticsBot-2.0.1 from dm\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:102:46)
at Object.run (C:\Users\Administrator\Downloads\StaticsBot-2.0.1 from dm\modules\commands\leaderboards.js:102:46)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'InteractionAlreadyReplied'
} Unhandled Rejection
How can this error still happen even with a catch?
1 Reply
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Want results from more Discord servers?
Add your server