Squidward
Squidward
DIAdiscord.js - Imagine an app
Created by Squidward on 1/15/2023 in #djs-questions
Why do I keep getting DiscordAPIError[40060]: Interaction has already been acknowledged.
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.
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`);
}
};
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
7 replies
DIAdiscord.js - Imagine an app
Created by Squidward on 9/2/2022 in #djs-questions
RangeError [EMBED_FIELD_VALUE] MessageEmbed field values must be non-empty strings.
When i try to add more fields I get this error RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
//Original Embed
const EmCarInfo = new MessageEmbed()
.setTitle('title')
.setDescription('Test Test 123')
.addFields(
{ name: 'Field Value', value: `Some values ${test123}` },
)
//Original Embed
const EmCarInfo = new MessageEmbed()
.setTitle('title')
.setDescription('Test Test 123')
.addFields(
{ name: 'Field Value', value: `Some values ${test123}` },
)
when I try to add more fields based on some condition:
if (handling != undefined) {
EmCarInfo.addFields(
{ name: 'test237', value: `Test 123 ${someOtherValue}` }
)
}
if (handling != undefined) {
EmCarInfo.addFields(
{ name: 'test237', value: `Test 123 ${someOtherValue}` }
)
}
I get an error, not sure why is this happening
34 replies