首页 > 解决方案 > DiscordAPIError:缺少权限

问题描述

当我试图用Discord.js禁止某人时,会出现此错误:

(node:10656) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async RequestHandler.push (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10656) 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). (rejection id: 1)
(node:10656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

带代码:

var memberID = message.guild.members.cache.get(target.id);

memberID.ban();

我的机器人拥有所有权限,并且我在 Discord 上进行了两步验证。有人能帮我吗?

标签: node.jsdiscord.js

解决方案


更多信息将不胜感激,但除此之外,角色越高,它的可访问性就越高。将您的角色推高应该可以解决问题,即使您受到速率限制,这也是一个问题。

权限层次结构

速率限制


推荐阅读