DiscordAPIError: Missing Permissions - Bot 崩溃而不是给出错误消息

时间:2021-05-03 17:29:34

标签: node.js discord.js embed

我的机器人会发送一条嵌入消息,每次您点击反应时都会更改页面,一些服务器拒绝授予机器人“管理消息”权限,这会导致机器人崩溃,我希望机器人回复错误消息,或者至少不会在每次有人做出反应时崩溃。

错误:

1.

DiscordAPIError: Missing Permissions
    at RequestHandler.execute (----\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (node:internal/process/task_queues:93:5) {
  method: 'delete',
  path: 
  code: 50013,
  httpStatus: 403

2.

(node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).

1 个答案:

答案 0 :(得分:0)


尝试在您的消息后放置一个 .catch((error) => {}) 块,如下所示:message.channel.send(embed).catch((error) => {console.log("error");}) 希望能帮到你
ShadowLp174