Is there a way to find out the highest role a user has?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Is there a way to find out the highest role a user has?



I want to create a command 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?


discord.user.top_role



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


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




1 Answer
1



Yes there is: https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=highestRole


member.highestRole.name





I have already tried highestRole before and it returns "Undefined." Is there a package I am missing? (I am using v11.3.2 of the discord.js library)
– Noobly387
Jul 23 at 18:37





Does the user have a role?
– André
Jul 24 at 9:30





Yes the user does have a role
– Noobly387
2 days ago





Edit your question to include the relevant code that you're trying to use
– André
2 days ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to scale/resize CVPixelBufferRef in objective C, iOS

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

SVG with two text elements. When one resizes due to textLength - how to resize the other one to the same character size