'DiscordAPIError: Unknown interaction in ALL interactions
My bot was working completely fine. And then all of a sudden I started getting the Unknown Interaction error.
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.reply (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:99:5) {
method: 'post',
path: Path here yk,
code: 10062,
httpStatus: 404,
requestData: {
json: {
type: 4,
data: {
content: 'POING',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
},
files: []
}
}
This ping command is just an example, I am getting this error in nearly every interaction command I type on Discord. I have been looking for the issue for a very long time now but still couldn't find anything.
This is the ping command:
const { CommandInteraction } = require("discord.js");
module.exports = {
name: "ping",
description: "Ping",
permission: "ADMINISTRATOR",
/**
*
* @param {CommandInteraction} interaction
*/
execute(interaction) {
interaction.reply({content: "POING"})
}
}
It's just a basic command I made to test if the issue is in the commands itself or somewhere else. Seems like it's somewhere else.
This is my interactionCreate event:
const { Client, CommandInteraction, MessageEmbed } = require("discord.js");
module.exports = {
name: "interactionCreate",
/**
*
* @param {CommandInteraction} interaction
* @param {Client} client
*/
async execute(interaction, client){
if(interaction.isCommand() || interaction.isContextMenu()){
const command = client.commands.get(interaction.commandName);
if(!command) return interaction.reply({embeds : [
new MessageEmbed()
.setColor("RED")
.setDescription("⛔ An error occurred while running this command.")
]}) && client.commands.delete(interaction.commandName);
command.execute(interaction, client);
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
