My code :
module.exports = {
name: "plusbg",
description: "Qui est le plus beau de ce serveur ?",
run: (client, message, args) => {
const embed = new MessageEmbed()
.setTitle('Le plus beau est Ratile')
.setThumbnail(client.user.displayAvatarURL())
.addField (
{ name: 'Latence', value: `\`${client.ws.ping}ms\``, inline: true },
{ name: 'Uptime', value: `<t:${parseInt(client.readyTimestamp / 1000)}:R>`, inline: true},
)
.setTimestamp()
.setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() });
message.channel.send({ embeds: [embed]});
},
runSlash: (client, interaction) => {
const embed = new MessageEmbed()
.setColor('DARK_VIVID_PINK')
.setTitle('Le plus beau est Ratile')
.setThumbnail(client.user.displayAvatarURL())
.addFields(
{ name: 'Latence', value: `\`${client.ws.ping}ms\``, inline: true },
{ name: 'Uptime', value: `<t:${parseInt(client.readyTimestamp / 1000)}:R>`, inline: true},
)
.setTimestamp()
.setFooter({ text: interaction.user.username, iconURL: interaction.user.displayAvatarURL() });
interaction.reply({ embeds: [embed]})
},
};
(the message is in french)
I can use the commands on discord, it's working, but in the terminal there is an error called Unknown interaction on the discord api.
-----
Promise {
<rejected> DiscordAPIError: Unknown interaction
at RequestHandler.execute (C:\Users\ratil\Desktop\Bot - Skypiea\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (C:\Users\ratil\Desktop\Bot - Skypiea\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async CommandInteraction.reply (C:\Users\ratil\Desktop\Bot - Skypiea\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:99:5) {
method: 'post',
path: '/interactions/992792318635683912/aW50ZXJhY3Rpb246OTkyNzkyMzE4NjM1NjgzOTEyOkhUUnI5ZXF1bUw3WmxuR1RoN3gyU2N4eGFNYjYxWGgzb2JhWjhyOXVNTnlHSnQ4azhqRkxQaUF4QTVwZTFUZkxZNjVHdEhEOXh4WklTV2g0Yk9xM28yQURPUFBlS2Qwd050R3BSbHVGcFVFdDNXWWlHUW5xUXZZbFdpTzAyc3Ry/callback',
code: 10062,
httpStatus: 404,
requestData: { json: [Object], files: [] }
}
}
Can you help me please
The interactionCreate file (that's french too) :
module.exports = {
name: "interactionCreate",
once: false,
async execute(client, interaction) {
if (interaction.isCommand()) {
const cmd = client.commands.get(interaction.commandName);
if (!cmd) return interaction.reply(`Cette commande n\'existe pas`);
cmd.runSlash(client, interaction);
}
}
};