#Why do I keep getting DiscordAPIError[40060]: Interaction has already been acknowledged.

6 messages · Page 1 of 1 (latest)

severe zodiac
#

I'm trying trying to create a basic ping command for my bot but I keep getting this error:

DiscordAPIError[40060]: Interaction has already been acknowledged.
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.

Here's my ping command code:

const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!'),
    async execute(interaction) {

        const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true });
        interaction.editReply(`Roundtrip latency: ${sent.createdTimestamp - interaction.createdTimestamp}ms`);
    }
};

I copied the other files like the index.js from the discord.js github with small modifications added:
Index.js: https://pastebin.com/By8k1RV7
deploy-commands.js: https://pastebin.com/jggUXikN

main cedar
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

severe zodiac
#

discord.js version: 14.7.1
node: 18.13.0

grave tide
#

Make sure you aren't deferring the reply within your command handler

severe zodiac
#

nvm