Represents a role on Discord.
Extends
BaseIf true, users that are part of this role will appear in a separate category in the users list
Compares this role's position to another role's.
Returns
Negative number if this role's position is lower (other role's is higher), positive number if this one is higher (other's is lower), 0 if equalName | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | Role to compare to this one |
Deletes the role.
Name | Type | Optional | Description |
---|---|---|---|
reason | string | Yes | Reason for deleting this role |
Edits the role.
Name | Type | Optional | Description |
---|---|---|---|
options | RoleEditOptions | No | The options to provide |
Whether this role equals another role. It compares all properties, so for most operations it is advisable to just compare
role.id === role2.id
as it is much faster and is often what most users need.Name | Type | Optional | Description |
---|---|---|---|
role | Role | No | Role to compare with |
A link to the role's icon
Returns
Name | Type | Optional | Description |
---|---|---|---|
options | ImageURLOptions | Yes | Options for the image URL |
Returns
channel.permissionsFor(role)
. Returns permissions for a role in a guild channel, taking into account permission overwrites.Name | Type | Optional | Description |
---|---|---|---|
channel | NonThreadGuildBasedChannel | Snowflake | No | The guild channel to use as context |
checkAdmin | boolean | Yes | Whether having the permission will return all permissions |
Sets a new color for the role.
Name | Type | Optional | Description |
---|---|---|---|
color | ColorResolvable | No | The color of the role |
reason | string | Yes | Reason for changing the role's color |
Sets whether or not the role should be hoisted.
Name | Type | Optional | Description |
---|---|---|---|
hoist | boolean | Yes | Whether or not to hoist the role |
reason | string | Yes | Reason for setting whether or not the role should be hoisted |
Sets a new icon for the role.
Name | Type | Optional | Description |
---|---|---|---|
icon | BufferResolvable | Base64Resolvable | EmojiResolvable | null | No | The icon for the role The EmojiResolvable should belong to the same guild as the role. If not, pass the emoji's URL directly |
reason | string | Yes | Reason for changing the role's icon |
Sets whether this role is mentionable.
Name | Type | Optional | Description |
---|---|---|---|
mentionable | boolean | Yes | Whether this role should be mentionable |
reason | string | Yes | Reason for setting whether or not this role should be mentionable |
Sets a new name for the role.
Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The new name of the role |
reason | string | Yes | Reason for changing the role's name |
Sets the permissions of the role.
Name | Type | Optional | Description |
---|---|---|---|
permissions | PermissionResolvable | No | The permissions of the role |
reason | string | Yes | Reason for changing the role's permissions |
Sets the new position of the role.
Name | Type | Optional | Description |
---|---|---|---|
position | number | No | The new position for the role |
options | SetRolePositionOptions | Yes | Options for setting the position |
Sets a new unicode emoji for the role.
Name | Type | Optional | Description |
---|---|---|---|
unicodeEmoji | string | null | No | The new unicode emoji for the role |
reason | string | Yes | Reason for changing the role's unicode emoji |
When concatenated with a string, this automatically returns the role's mention instead of the Role object.