When I try to edit a reply to a slash command using interaction.editReply()
after having deferred it using interaction.deferReply()
I get a DiscordAPIError[50027]: Invalid Webhook Token.
The deferReply goes through without a problem because I do get the bot is thinking...
message, but as soon as I call the editReply it triggers the error message. Using interaction.reply()
does not throw this error, but I can not confidently say that all interactions can be replied to within 3 seconds because data has to be fetched from a database.
I am completely lost as to what could cause this error, especially because I can not remember changing anything in the code that could have any influence on this which is backed up by the fact that a older version of this project is giving me the same error while it did work literally yesterday.
Here is the full error message I am getting:
E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\@discordjs\rest\dist\index.js:748
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[50027]: Invalid Webhook Token
at SequentialHandler.runRequest (E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\@discordjs\rest\dist\index.js:748:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\@discordjs\rest\dist\index.js:560:14)
at async REST.request (E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\@discordjs\rest\dist\index.js:1000:22)
at async InteractionWebhook.editMessage (E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\discord.js\src\structures\Webhook.js:324:15)
at async ChatInputCommandInteraction.editReply (E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:150:21)
at async E:\OneDrive\Developing\Discord\JavaScript\Discord bot\Code\commands\raids\account.js:68:21 {
rawError: { message: 'Invalid Webhook Token', code: 50027 },
code: 50027,
status: 401,
method: 'PATCH',
url: 'https://discord.com/api/v10/webhooks/997498462792859720/aW50ZXJhY3Rpb246MTAwMDAyNTAzNTM0NTUxMDQxMDpvUEVwOXNZWEYwU2F3THFHazgyMGZESXIyOXpaS0Y0NE1IdHdZZzk4WjFnbmR2bVcyWU03SGF4bWhXbzF3S0NCREJqbzhQZmNTRUljV0U0N2dhR2xtNTNXRnBuNzg5ZGZ3M2lXN2NjQTgyUU1MbkhKdEE5NUVWRFIzM0NYdFo4WQ/messages/@original',
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
title: 'Switch account',
description: 'Choose your new active account from the list below.',
color: 2132654
}
],
components: [ { type: 1, components: [ [Object] ] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
}
}
Any help is greatly appreciated.
CodePudding user response:
Don't worry, everyone using the discord api is having this issue. It is now fixed.