当我在使用interaction.deferReply()
延迟对斜杠命令的回复后,try 使用interaction.editReply()
编辑对斜杠命令的回复时,我得到了一个DiscordAPIError[50027]:无效的Webhook令牌.
deferReply没有问题,因为我确实收到了bot is thinking...
条消息,但只要我调用editReply,它就会触发错误消息.使用interaction.reply()
不会引发这个错误,但我不能自信地说所有交互都可以在3秒钟内回复,因为必须从数据库中获取数据.
我完全不知道是什么导致了这个错误,尤其是因为我不记得在代码中更改了任何可能会对此产生任何影响的内容,这是由一个事实支持的,即这个项目的旧版本在昨天确实工作时给了我相同的错误.
下面是我收到的完整错误消息:
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
}
}
}
非常感谢您的帮助.