#Interaction has already been acknowledged - yet I am not acknowledging it ?
12 messages · Page 1 of 1 (latest)
• 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.
Once Show Code
typing it out now
Means Interaction Is Defined Multi Times
// command-handler.ts
if (!interaction.isChatInputCommand()) return
const _cantExecute = CustomEmbed.general.unsuccessful_execution;
try {
const commandName = interaction.commandName
const command = allCommandsMap.get(commandName)
if (!command) throw new Error('Command not found.')
await command.exec({
client,
interaction
});
// client.command_log(client, interaction.user, interaction.commandName);
} catch (error) {
client.log(`[Command Error] [${interaction?.commandName}]`, error)
if (interaction.deferred || interaction.replied) {
return interaction.editReply({
embeds: [_cantExecute()]
})
}
return interaction.reply({
ephemeral: true,
embeds: [_cantExecute()]
})
}
// command.ts
const meta = new SlashCommandBuilder()
.setName('valorant')
.setDescription('Get information about a Valorant Account.')
.addStringOption((option) =>
option
.setName('name')
.setDescription('What is the username of the user you would like to check? (Ex: Reflex#1234)')
.setRequired(true)
)
export default command(meta, async ({ interaction }) => {
const user = interaction.options.getString('name', true);
await interaction.reply({
content: 'test'
});
return 0;
})
I get this error:
[[Command Error] [valorant]] DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (U:\Coding\roffle_bot\node_modules\@discordjs\rest\dist\index.js:640:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async BurstHandler.runRequest (U:\Coding\roffle_bot\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (U:\Coding\roffle_bot\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.reply (U:\Coding\roffle_bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.exec (U:\Coding\roffle_bot\dist\commands\general\valorant.js:22:5)
at async Object.exec (U:\Coding\roffle_bot\dist\events\interactionCreate\commands.js:19:9)
at async CustomClient.<anonymous> (U:\Coding\roffle_bot\dist\utils\event.js:15:17) {
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/1111607251543789638/aW50ZXJhY3Rpb246MTExMTYwNzI1MTU0Mzc4OTYzODpmSm0wUXVYUjhPZHNqTG5QRmlvYVo1NTBBQ1UwdzRVN2NXaGJGeG5zRTFxalBBMEJyODFja2JPTzdLeDQ0VFN6RjZWMEp0TkJFY3lWbW51TkhRTHN2clhBbzR6Q0xhT3JxbWlURGFnOUtJQkM3R29qb0FlSks2aXRXUUdrVm9iRw/callback'
}
The output I am getting doesn't seem to match with my error.
If the interaction has already been acknowledged? The only thing that could have done it is the catch function of the command handler, no?
?