我想创建一个命令,以查找用户在服务器中担任的最高角色。
我已经知道Python中有一个discord.user.top_role
。是否有与之等效的Javascript?
我正在尝试将此代码用于userinfo
命令:
if(arg.length === 0) {
let userInfoEmbed = new Discord.RichEmbed()
.setTitle("User Information")
.setColor(sender.displayHexColor)
.setThumbnail(sender.avatarURL)
.addField("User Name", sender.username)
.addField("User ID", sender.id)
.addField("Status", sender.presence.status)
.addField("User Joined", message.guild.joinedAt)
.addField("User's Highest Role", sender.highestRole.name)
message.channel.send(userInfoEmbed);
答案 0 :(得分:1)
是的,有:https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=highestRole
member.highestRole.name
答案 1 :(得分:0)
您可以通过
member.roles.highest
应该是
sender.roles.highest.name