Error [InteractionAlreadyReplied] The reply to this interaction has already been sent or deferred.
const { EmbedBuilder, SlashCommandBuilder, Integration } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Gets Bot and API ping'),
async execute(interaction) {
const pingEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Calculating Bot Ping...')
await interaction.reply({ embeds: [pingEmbed]})
const apiPing = client.ws.ping;
const botPing = interaction.createdTimestamp - message.createdTimestamp;
const pingFinalEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Ping')
.setDescription(`**API Ping:** ${apiPing}ms\n**Bot Ping:** ${botPing}ms`)
await wait(2000);
await interaction.editReply({ embeds: [pingFinalEmbed]});
}
}
const { EmbedBuilder, SlashCommandBuilder, Integration } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Gets Bot and API ping'),
async execute(interaction) {
const pingEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Calculating Bot Ping...')
await interaction.reply({ embeds: [pingEmbed]})
const apiPing = client.ws.ping;
const botPing = interaction.createdTimestamp - message.createdTimestamp;
const pingFinalEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Ping')
.setDescription(`**API Ping:** ${apiPing}ms\n**Bot Ping:** ${botPing}ms`)
await wait(2000);
await interaction.editReply({ embeds: [pingFinalEmbed]});
}
}
12 Replies
•
DiscordAPIError: Interaction has already been acknowledged
• [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
You have already replied to the interaction.
• Use <Interaction>.followUp()
to send a new message
• If you deferred reply it's better to use <Interaction>.editReply()
• Responding to slash commands / buttons / select menusReferenceError: client is not defined
at Object.execute (D:\PA_Admin Backup copy\Commands\ping.js:12:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:12:13)
node:events:498
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (D:\PA_Admin Backup copy\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101:46)
at Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:15:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
[Symbol(code)]: 90
}
ReferenceError: client is not defined
at Object.execute (D:\PA_Admin Backup copy\Commands\ping.js:12:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:12:13)
node:events:498
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (D:\PA_Admin Backup copy\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101:46)
at Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:15:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
[Symbol(code)]: 90
}
use interaction.client
ReferenceError: message is not defined
at Object.execute (D:\PA_Admin Backup copy\Commands\ping.js:13:56)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:12:13)
node:events:498
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (D:\PA_Admin Backup copy\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101:46)
at Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:15:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
[Symbol(code)]: 90
}
ReferenceError: message is not defined
at Object.execute (D:\PA_Admin Backup copy\Commands\ping.js:13:56)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:12:13)
node:events:498
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (D:\PA_Admin Backup copy\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101:46)
at Object.execute (D:\PA_Admin Backup copy\Events\interactionCreate.js:15:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
[Symbol(code)]: 90
}
you didnt define message
TypeError: Cannot read properties of undefined (reading 'createdTimestamp')
TypeError: Cannot read properties of undefined (reading 'createdTimestamp')
const botPing = interaction.createdTimestamp - interaction.createdTimestamp;
const botPing = interaction.createdTimestamp - interaction.createdTimestamp;
0ms
0ms
x - x is 0
ik
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
const interactionTime = interaction.fetchReply()
const botPing = interactionTime.createdTimestamp - interaction.createdTimestamp;
const interactionTime = interaction.fetchReply()
const botPing = interactionTime.createdTimestamp - interaction.createdTimestamp;
.fetchReply() returns a promise
const message = await interaction.fetchReply();
const botPing = message.createdTimestamp - interaction.createdTimestamp;
const message = await interaction.fetchReply();
const botPing = message.createdTimestamp - interaction.createdTimestamp;
//As Embed
Ping
API Ping: 106ms
Bot Ping: 204ms
//As Embed
Ping
API Ping: 106ms
Bot Ping: 204ms