它不会让我更改昵称 discord.js
Posted
技术标签:
【中文标题】它不会让我更改昵称 discord.js【英文标题】:it won't let me change the nickname discord.js 【发布时间】:2021-03-29 15:57:00 【问题描述】:client.on("message", async (message) => let roles = ????????????????????: “所有者”, 管理员:“[ADM]”, 主持人:“[MOD]”, DcMod: "[DC]", 助推器:“[BOOST]”, Usuario:“[用户]”
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.
【问题讨论】:
***.com/a/49866239/1935718 可能重复。 【参考方案1】:表示您的机器人无权更新用户的昵称。尝试给机器人这些权限,看看它做了什么。
【讨论】:
只有我的用户名才会发生在我的用户身上,如果它有效的话【参考方案2】:根据https://***.com/a/49866239/1935718,您需要分配给机器人的 MANAGE_NICKNAMES 权限。
【讨论】:
以上是关于它不会让我更改昵称 discord.js的主要内容,如果未能解决你的问题,请参考以下文章