Entity Info
userRoles
$userRoles
Returns the list of role IDs assigned to the user on the current server.
Syntax
$userRoles
$userRoles
The $userRoles function returns the list of role IDs assigned to the user on the server where the command is executed.
Syntax
$userRoles
Return Value
- Type: List of snowflakes (numerical strings), separated by commas
- Example:
123456789,987654321,555555555 - Includes the
@everyonerole and all assigned roles.
Behavior
$userRolestakes no arguments.- Returns the IDs of all the roles of the user on the server.
- The order may correspond to the hierarchy (from lowest to highest).
Examples
Display role IDs
$title[Roles of $userName]
$description[
The user has the following roles:
`$userRoles`
]
$color[#5865F2]
$sendMessage[]
Check for a specific role
$if[$checkContains[$userRoles;123456789012345678]==true]
$sendMessage[You have the VIP role!]
$else
$sendMessage[You do not have the VIP role.]
$endif
Count roles
$let[count;$arrayCount[$splitText[$userRoles;,]]]
$sendMessage[You have $count roles on this server.]
Notes
- The IDs are numerical snowflakes, not role names.
- Use
$roleName[ID]to get the name of a role from its ID. - To check permissions, use
$userPermswhich is more directly exploitable.