DiscordAPIError[40060]: Interaction has already been acknowledged.

I have no idea how this error is occurring, can someone help me out?
7 Replies
d.js toolkit
d.js toolkit3y ago
• 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.
! Mur Lee
! Mur LeeOP3y ago
! Mur Lee
! Mur LeeOP3y ago
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/home/container/commands/slash/add.js:66:13)
at async Object.execute (/home/container/events/guild/interactionCreate.js:56:21) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1099536822226391080/aW50ZXJhY3Rpb246MTA5OTUzNjgyMjIyNjM5MTA4MDoxUVVSdGFUaDA4cDdVbjhpYXA1amN0c1dsa0NnUms3T1FBWGZhR0pFZXQwMjJ1NHBhQnhQNVd6TG1nUUVNT25sZ2JLS0lEVWdJVzFNVHZla09ySExlUkxCTktjdGJNTkwyZmVoVGdodHZqOTNoeTVtMVRlc0RqblF4Smx0cEtQdQ/callback'
}
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ChatInputCommandInteraction.reply (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
at async Object.execute (/home/container/commands/slash/add.js:66:13)
at async Object.execute (/home/container/events/guild/interactionCreate.js:56:21) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1099536822226391080/aW50ZXJhY3Rpb246MTA5OTUzNjgyMjIyNjM5MTA4MDoxUVVSdGFUaDA4cDdVbjhpYXA1amN0c1dsa0NnUms3T1FBWGZhR0pFZXQwMjJ1NHBhQnhQNVd6TG1nUUVNT25sZ2JLS0lEVWdJVzFNVHZla09ySExlUkxCTktjdGJNTkwyZmVoVGdodHZqOTNoeTVtMVRlc0RqblF4Smx0cEtQdQ/callback'
}
module.exports = {
data: new SlashCommandBuilder()
.setName('add')
.setDescription('Add someone to the ticket (Ticket Command) ')
.setDMPermission(false)
.addUserOption(option =>
option.setName('target')
.setDescription('Member to add to ticket')
.setRequired(true)),
async execute(interaction, client) {

const ticketDoc = await ticketData.findOne({
ticketGuildID: interaction.guild.id
}).catch(err => console.log(err));

const chan = client.channels.cache.get(interaction.channelId);
const user = interaction.options.getUser('target');
const userID = user.id;

let Support_Role = ticketDoc.ticketSupportID;

if (chan.name.includes('ticket')) {
chan.edit({
permissionOverwrites: [
{
id: userID,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
},
{
id: interaction.guild.roles.everyone,
deny: [PermissionFlagsBits.ViewChannel],
},
{
id: Support_Role,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
},
],
}).then(async () => {
interaction.reply({
content: `<@${user.id}> has been added to the ticket!`
});
});

} else {
const ReplyEmbed = new EmbedBuilder()
.setColor("#ED4245")
.setDescription('You are not in a Ticket!')

await interaction.reply({
embeds: [ReplyEmbed],
ephemeral: true
});
};
},
};
module.exports = {
data: new SlashCommandBuilder()
.setName('add')
.setDescription('Add someone to the ticket (Ticket Command) ')
.setDMPermission(false)
.addUserOption(option =>
option.setName('target')
.setDescription('Member to add to ticket')
.setRequired(true)),
async execute(interaction, client) {

const ticketDoc = await ticketData.findOne({
ticketGuildID: interaction.guild.id
}).catch(err => console.log(err));

const chan = client.channels.cache.get(interaction.channelId);
const user = interaction.options.getUser('target');
const userID = user.id;

let Support_Role = ticketDoc.ticketSupportID;

if (chan.name.includes('ticket')) {
chan.edit({
permissionOverwrites: [
{
id: userID,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
},
{
id: interaction.guild.roles.everyone,
deny: [PermissionFlagsBits.ViewChannel],
},
{
id: Support_Role,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
},
],
}).then(async () => {
interaction.reply({
content: `<@${user.id}> has been added to the ticket!`
});
});

} else {
const ReplyEmbed = new EmbedBuilder()
.setColor("#ED4245")
.setDescription('You are not in a Ticket!')

await interaction.reply({
embeds: [ReplyEmbed],
ephemeral: true
});
};
},
};
Rhae
Rhae3y ago
Show your interactionCreate file
! Mur Lee
! Mur LeeOP3y ago
Pastebin
const { EmbedBuilder, Collection, PermissionsBitField} = r...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Rhae
Rhae3y ago
Hm try to await your reply in your if statement in the slash. Honestly, you have so may nested ifs but if it's worked before from your interactionCreate file, then try to await it.
! Mur Lee
! Mur LeeOP3y ago
I found the issue, I've been running the 2 application using same bot token. Mb I.e FiveM Txadmin and My ticket bot

Did you find this page helpful?