Entity Info
roleName
$roleName
The function $roleName returns the name of a Discord role from its ID.
Syntax
$roleName[roleID]
Parameters
| Parameter | Description |
|---|---|
roleID |
The ID of the role in the current server. Required. An invalid ID raises “Invalid role ID.”; an unknown role raises “Role not found.”. |
Return Value
| Type | Description |
|---|---|
string |
The name of the role (e.g., Admin, Moderator). |
Examples
Get the name of a role
$sendMessage[The role ID 123456789012345678 is: $roleName[123456789012345678]]
Display the name of the highest role of a user
$sendMessage[Your highest role: $roleName[$getRole[$authorID;1]]]
Verify a role name
$if[$roleName[123456789012345678]==Admin]
$sendMessage[This is indeed the Admin role.]
$endif
Notes
- The ID of the role must exist on the current server, otherwise an error is raised.
- To get the ID from a name, use
$roleID. - To list all roles, use
$roleNames.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.