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