【问题标题】:it won't let me change the nickname discord.js它不会让我更改昵称 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.

【问题讨论】:

标签: javascript discord discord.js


【解决方案1】:

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

【讨论】:

  • 只有我的用户名才会发生在我的用户身上,如果它有效的话
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2018-12-09
    • 2021-12-27
    • 2021-02-16
    • 2017-05-05
    • 2021-05-20
    • 2020-08-22
    • 2021-03-13
    • 1970-01-01
    • 2020-07-11
    相关资源
    最近更新 更多