javascript - Is there a way to find out the highest role a user has? - Stack Overflow

I want to create a mand that can find the highest role that a user has in a server. I already know ther

I want to create a mand that can find the highest role that a user has in a server.

I already know there is a discord.user.top_role in Python. Is there a Javascript equivalent for that?

I am trying to use this code for a userinfo mand:

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);

I want to create a mand that can find the highest role that a user has in a server.

I already know there is a discord.user.top_role in Python. Is there a Javascript equivalent for that?

I am trying to use this code for a userinfo mand:

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);
Share Improve this question edited Jul 25, 2018 at 21:19 Noobly387 asked Jul 23, 2018 at 1:22 Noobly387Noobly387 431 gold badge3 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Yes, there is.


Discord JS V12

GuildMember.roles.highest

Discord JS V11

GuildMember.highestRole

You can get it by

member.roles.highest

So it would be

sender.roles.highest.name

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742330375a4423597.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信