Unknown interaction

The idea is to use a slash command to run a separate js file, which would reduce hunger and thirst. If any of the two arrived at 15, he would send a message, through the interaction, that he needed to drink, urgently. However, when I execute the slash command, and the js file is also executed afterwards, when sending the message through the interaction, when I reach 15, it says that the interaction is unknown.
3 Replies
d.js toolkit
d.js toolkit17mo 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. - Issue solved? Press the button!
usuario_366
usuario_366OP17mo ago
console:
Fora498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro outro498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro 15498212702578016267
Dentro 15498212702578016267
Erro ao responder a interação: Unknown interaction
Erro completo: DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\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\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.reply (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5) { requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1131919196935172228/aW50ZXJhY3Rpb246MTEzMTkxOTE5NjkzNTE3MjIyODpwOWxQRjFiTExidjRXazR2eEFjU0NkN3dCUjNhSGFmMVdqckpSa2s1bDVkczhSZk1tdEZRVHJyYWplc0QzeTN3QlUxNFY5WkFGSHRVN1F0THRWdlYza2dpMUxWV1FZZjhxSGFtWEJIWW41T3BBdWljWXVQY1JydTNWUXNNSHBPcw/callback'
}
Interaction ID: 1131919196935172228
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro outro498212702578016267
Fora498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro outro498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro 15498212702578016267
Dentro 15498212702578016267
Erro ao responder a interação: Unknown interaction
Erro completo: DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\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\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.reply (C:\Users\JARDEL\Desktop\Programming\Robots\Discord\RPGame\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5) { requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1131919196935172228/aW50ZXJhY3Rpb246MTEzMTkxOTE5NjkzNTE3MjIyODpwOWxQRjFiTExidjRXazR2eEFjU0NkN3dCUjNhSGFmMVdqckpSa2s1bDVkczhSZk1tdEZRVHJyYWplc0QzeTN3QlUxNFY5WkFGSHRVN1F0THRWdlYza2dpMUxWV1FZZjhxSGFtWEJIWW41T3BBdWljWXVQY1JydTNWUXNNSHBPcw/callback'
}
Interaction ID: 1131919196935172228
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Meio498212702578016267
Dentro outro498212702578016267
I've tried checking if the interaction is valid before executing and putting a catch block just in case. And, it still executes, and it stops at the catch block.
if(interaction && !interaction.replied)
{
interaction.reply
(
{
content: "SEDE!",
ephemeral: true
}
).catch
(
error =>
{
console.error("Erro ao responder a interação:", error.message);
console.error("Erro completo:", error);
console.error("Interaction ID:", interaction.id);
}
);
}
if(interaction && !interaction.replied)
{
interaction.reply
(
{
content: "SEDE!",
ephemeral: true
}
).catch
(
error =>
{
console.error("Erro ao responder a interação:", error.message);
console.error("Erro completo:", error);
console.error("Interaction ID:", interaction.id);
}
);
}
d.js docs
d.js docs17mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. * Note: you cannot defer modal or autocomplete value responses
Want results from more Discord servers?
Add your server