Commands send twice

Commands send twice pushes an error to console and sends an error There was an error while executing this command!
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\bhrae\Desktop\shitbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:104:46)
at Object.execute (C:\Users\bhrae\Desktop\shitbot\commands\utility\createapp.js:89:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\bhrae\Desktop\shitbot\events\ready.js:16:4) {
code: 'InteractionAlreadyReplied'
}
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\bhrae\Desktop\shitbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:104:46)
at Object.execute (C:\Users\bhrae\Desktop\shitbot\commands\utility\createapp.js:89:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\bhrae\Desktop\shitbot\events\ready.js:16:4) {
code: 'InteractionAlreadyReplied'
}
16 Replies
d.js toolkit
d.js toolkit4mo 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!
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
alr they do not node v21.7.3 discord js ver is in tag.
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
from which file because it affects all commands
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
i dont though because if i kill the node index.js commands dont work and when i start it it does that
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
i mean i can try using powershell instead of nushell Powershell doesnt fix the issue
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
nope not that i can think of the only thing i did was try making a command but i dont see how a command makes all commands send twice I did delete registered commands and now ping doesnt register nvm it does ping does unknown interaction and sends twice well i figured out the error but it still sends twice the first one
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
if i do uhh
await interaction.reply({ content: 'Application created!', ephemeral: true });
await interaction.reply({ content: 'Application created!', ephemeral: true });
it causes the error after
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
RealMrCactus
RealMrCactusOP4mo ago
const { Events } = require('discord.js');

module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
},
};
const { Events } = require('discord.js');

module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
},
};
@Jö🌈🦄
Want results from more Discord servers?
Add your server