Whenever I try send an embed using slash commands in my bot, I get a DiscordAPIError, which looks something like this:
/home/runner/TFOBOT/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/home/runner/TFOBOT/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/TFOBOT/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.reply (/home/runner/TFOBOT/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:99:5) {
method: 'post',
path: '/interactions/937065446656577627/aW50ZXJhY3Rpb246OTM3MDY1NDQ2NjU2NTc3NjI3Ok5wSVRGNzlBZkJ6YURJNWtqR29tMmdLd1FpRUpXQVEySHRTZmlPa1d1elpWbG5XOUJudkNubDNlMmc4WnM2bDZFOUhiTm9TOXJMaDJmYVpOUFd2WmJQUnl2d0tkVEs1dDJoNHV2VmJhTElsZUhWbGNyd3FoOTNTTGp1NGZKTFZ5/callback',
code: 10062,
httpStatus: 404,
requestData: {
json: {
type: 4,
data: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
title: 'XP for MystX2',
type: 'rich',
description: null,
url: null,
timestamp: 2022-01-29T19:23:50.855Z,
color: 3447003,
fields: [Array],
thumbnail: [Object],
image: null,
author: null,
footer: [Object]
}
],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
},
files: []
}
}
I only ever get these errors when attempting to reply to an interaction with an embed, any ideas on how to fix? It appears to me that the interaction cannot be found, however, it always works without fail if I do not include an embed, and just regular text instead.
For reference, this is the code which is causing the errors:
interaction.reply({ embeds:[xpEmbed] })