Error

Whenever I use my ping slash commands, I recieve a 'Interaction has already been acknowledged.' error. I still works in the chat room though. How can I get rid of it?
1 Reply
Chord
ChordOPโ€ข17mo ago
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('It prints delay time'),
async execute(interaction) {
await interaction.deferReply();

const reply = await interaction.fetchReply();

const ping = reply.createdTimestamp - interaction.createdTimestamp;

interaction.editReply(`๐Ÿ“pong! (${ping}ms)`);
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('It prints delay time'),
async execute(interaction) {
await interaction.deferReply();

const reply = await interaction.fetchReply();

const ping = reply.createdTimestamp - interaction.createdTimestamp;

interaction.editReply(`๐Ÿ“pong! (${ping}ms)`);
},
};
Here is my ping.js code no I'm only running it in the VS code and here is my full error message :
Error executing ํ•‘
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\stone\Desktop\Ina_2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:69:5)
at async Object.execute (C:\Users\stone\Desktop\Ina_2.0\commands\function\ping.js:8:5)
at async Object.execute (C:\Users\stone\Desktop\Ina_2.0\events\interactionCreate.js:16:4) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1135242832404299807/aW50ZXJhY3Rpb246MTEzNTI0MjgzMjQwNDI5OTgwNzpZS1ZzSTFvRkZxUGF5THNoWjFhY1kxUGJHdEV5YXNXams3UHFCcFJ1MVNXc0dEZmZOTWIzVVo1NlBEcW1jYlBBRGFZZ0lCT2thZWtNWWpkbFByMjFZNldCTHZoOE53TlFhelpvMWdLdGdXa2FWOTdYVElyZ1piVjVRUWlERFlRNQ/callback'
}
Error executing ํ•‘
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\stone\Desktop\Ina_2.0\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\stone\Desktop\Ina_2.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:69:5)
at async Object.execute (C:\Users\stone\Desktop\Ina_2.0\commands\function\ping.js:8:5)
at async Object.execute (C:\Users\stone\Desktop\Ina_2.0\events\interactionCreate.js:16:4) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1135242832404299807/aW50ZXJhY3Rpb246MTEzNTI0MjgzMjQwNDI5OTgwNzpZS1ZzSTFvRkZxUGF5THNoWjFhY1kxUGJHdEV5YXNXams3UHFCcFJ1MVNXc0dEZmZOTWIzVVo1NlBEcW1jYlBBRGFZZ0lCT2thZWtNWWpkbFByMjFZNldCTHZoOE53TlFhelpvMWdLdGdXa2FWOTdYVElyZ1piVjVRUWlERFlRNQ/callback'
}
Ok I will try Oh it was running on the discloud. Sorry for taking up your time.. Thank you and have a good day ๐Ÿ™‚
Want results from more Discord servers?
Add your server