当我在使用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
    }
  }
}

非常感谢您的帮助.

推荐答案

别担心,每个使用discord api的人都有这个问题.现在已修复.

2: 下午12点

Hi everyone. There is currently an issue being investigated with interaction edits, deletes, and followups. This issue results in receiving 50027: Invalid Webhook Token errors when trying to edit, delete, follow up, or take some other actions on interaction webhooks. And then there's Mason Today at 2: 下午12点

4: 下午37点

Webhook token problem has been identified and we are working on rolling out a fix. We will update this message when it is resolved. And then there's Mason Today at 4:37PM

5: 下午43点

应该修复webhook令牌问题.

As a reminder, we saw a Snowflake length increase to 19 characters today! Ian 2 aka Desch at 5:43PM

Node.js相关问答推荐

当建议在第二代上运行云功能时,现在是否有新的Firestore AdminClient可供使用?

利用Gemini:通过Vertex AI还是通过Google/generative-ai?

聚合发布/订阅消息

Mongoose查询-如何根据当前查找ID获取其他集合并将其插入到当前查找中?

MongoDB-$Lookup未获得适当的结果

Mongoose post中间件触发deleteMany

将文件传递到 AWS lambdas(nodejs) + API 网关后重新上传文件

使用 NPM 三个 mocha+typescript 进行测试

图像存储在后端文件夹中,但使用 multer 和 react.js 在前端找不到

在mongodb中只查询整数

表达限制资源属于特定用户的优雅方式

如何更新 MongoDB 中对象数组中的键?

配额超出了每分钟的 Sheets API 写入请求数. node .js

在 Express-js 中使用路由

如何在 Nest.js 中使用查询参数?

Handlebars:访问已被拒绝解析来自的属性,因为它不是其父级的自己的属性

Chrome 浏览器未将 if-modified-since 标头发送到服务器

使用 NodeJS 将新对象附加到 DynamoDB 中的 JSON 数组

有人在 NodeJS 中实现过 wiki 吗?

npm 出现无法读取依赖项错误