它不会让我更改昵称 discord.js

时间:2020-12-19 03:45:32

标签: javascript discord discord.js

<块引用>

client.on("message", async (message) => { let roles = { ?????: "业主", 管理员:“[ADM]”, 主持人:“[MOD]”, DcMod: "[DC]", 助推器:“[BOOST]”, 用法:“[USER]”

}


let nombrerol = message.member.roles.cache.size <= 1 ? "Usuario" : message.member.roles.highest.name;


message.member.setNickname(`${roles[nombrerol]} ${message.author.username}`) })

我收到这个错误

(node:2604) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (E:\Bots\Skyliner[RP] Bots\XD\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async RequestHandler.push (E:\Bots\Skyliner[RP] Bots\XD\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
    at async GuildMember.edit (E:\Bots\Skyliner[RP] Bots\XD\node_modules\discord.js\src\structures\GuildMember.js:312:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2604) 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:2604) [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.

3 个答案:

答案 0 :(得分:0)

表示您的机器人没有更新用户昵称的权限。尝试授予机器人这些权限,看看它做了什么。

答案 1 :(得分:0)

您需要根据 https://stackoverflow.com/a/49866239/1935718 分配给机器人的 MANAGE_NICKNAMES 权限。

答案 2 :(得分:0)

这只会发生在我的用户名上 当我是服务器的创建者时,其他人是否有效