【问题标题】:DiscordAPIError: Missing Permissions - Bot crashes instead of giving error messageDiscordAPIError:缺少权限 - 机器人崩溃而不是给出错误消息
【发布时间】:2021-07-26 02:52:37
【问题描述】:

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

错误:

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).

【问题讨论】:

标签: node.js discord.js embed


【解决方案1】:


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

【讨论】:

    猜你喜欢
    • 2021-01-01
    • 2021-11-29
    • 2021-12-18
    • 2021-06-29
    • 1970-01-01
    • 2021-01-19
    • 2016-08-20
    • 1970-01-01
    • 2021-03-03
    相关资源
    最近更新 更多