Represents a role on Discord.
Extends
BaseCompares 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 equalExample
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | Role to compare to this one |
Deletes the role.
Example
Name | Type | Optional | Description |
---|---|---|---|
reason | string | Yes | Reason for deleting this role |
Edits the role.
Example
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 PermissionFlagsBits.Administrator permission will return all permissions |
Sets a new color for the role.
Example
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.
Example
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.
Example
Sets a new name for the role.
Example
Sets the permissions of the role.
Example
Example
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.
Example
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.
Example
When concatenated with a string, this automatically returns the role's mention instead of the Role object.