DiscordAPIError:缺少权限

时间:2021-02-23 09:34:51

标签: node.js discord.js

当我尝试使用 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 进行了两步验证。 有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

如果您提供更多信息,我们将不胜感激,但除此之外, 角色越高,它的可访问性就越高。 把你的角色推到更高的位置应该可以解决问题,如果你被限速,那也是一个问题。

Permission Hierarchy

Rate Limits