【发布时间】:2021-04-01 21:00:24
【问题描述】:
我正在创建一个设置昵称命令,这是我的代码:
if (message.mentions.members.first().roles.highest.position > bot.user.roles.highest.position) return message.channel.send("My highest role is lower than the mentioned user's role");
但是那个代码有错误:Type error: Cannot read property of "highest" of undefined
我也试过这个:
if (message.mentions.members.first().roles.highest.comparePositionTo(bot.user.roles.highest) > 0) {
return message.channel.send("Your highest role is lower than the mentioned user's role");
}
知道如何解决吗?
【问题讨论】:
标签: javascript node.js discord discord.js