每次我尝试使用我的机器人更改服务器中其他人的昵称(甚至是朋友的服务器中的我自己),它都会失败,给我带来以下错误:(node:11620) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions at RequestHandler.execute (C:\Users\(User)\Desktop\Discord Bot\Nick-Cycle\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:97:5)(node:11620) 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 handledwith .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:11620) [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.我检查了一下,它确实有管理昵称,它的角色就在所有者下面。我试图改变昵称的人,他的最高角色远远低于机器人。机器人的角色、职位和管理昵称权限的图像。代码如下:client.on('message', async message => { const prefix = ";" if (message.author.bot) return; if (!message.guild) return; if (!message.content.startsWith(prefix)) return; const args = message.content.slice(prefix.length).trim().split(/ +/g); const cmd = args.shift().toLowerCase(); switch(cmd) { case "setnick": if (!message.guild.me.hasPermission("MANAGE_NICKNAMES")) return message.channel.send("I don't have Manage Nicknames!"); if (!args[0]) return message.channel.send("Not enough arguments!"); if (args[0] === getUserFromMention(args[0])) { const user = getUserFromMention(args[0]) if (!args[1]) return message.channel.send("Not enough arguments!"); message.guild.members.fetch(user).setNickname(args[1]); } else { message.member.setNickname(args[0]); } break; } });怎么了?这是一个小故障吗?角色中是否有问题?还是我的代码有问题?
添加回答
举报
0/150
提交
取消