“ UnhandledPromiseRejectionWarning:DiscordAPIError:缺少权限”

时间:2020-06-01 10:13:14

标签: javascript discord.js

我正在尝试编写一个机器人程序,以使当用户加入服务器时它会为他添加角色“ Banda canina”,我试图给他一个管理员角色,但它继续出现此错误。这是代码

UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (C:\Users\Pc\Desktop\Bot Gio\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8268) 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: 2)

我在另一台测试服务器上尝试了该bot,它可以工作,但在主服务器上却没有。这是完整的错误:

test1

1 个答案:

答案 0 :(得分:0)

您的漫游器应具有在该服务器中管理角色的权限,并且还应具有超过它赋予新成员的角色的权限。

role hierarchy should look like this

manage roles should be turned on for the bot