Manages API methods for roles and stores their cache.
Extends
CachedManager<Snowflake, Role, RoleResolvable>The cache of items for this manager.
Inherited from DataManagerThe client that instantiated this Manager
Inherited from BaseManagerThe data structure belonging to this manager.
Inherited from DataManagerGets the managed role a user created when joining the guild, if any Only ever available for bots
Returns
Name | Type | Optional | Description |
---|---|---|---|
user | UserResolvable | No | The user to access the bot role for |
Compares the positions of two roles.
Returns
Negative number if the first role's position is lower (second role's is higher), positive number if the first's is higher (second's is lower), 0 if equalName | Type | Optional | Description |
---|---|---|---|
role1 | RoleResolvable | No | First role to compare |
role2 | RoleResolvable | No | Second role to compare |
Creates a new role in the guild with given information. The position will silently reset to 1 if an invalid one is provided, or none.
Example
Example
Name | Type | Optional | Description |
---|---|---|---|
options | RoleCreateOptions | Yes | Options for creating the new role |
Deletes a role.
Example
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | The role to delete |
reason | string | Yes | Reason for deleting the role |
Edits a role of the guild.
Example
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | The role to edit |
options | RoleEditOptions | No | The options to provide |
Obtains a role from Discord, or the role cache if they're already available.
Example
Example
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The role's id |
options | BaseFetchOptions | Yes | Additional options for this fetch |
Resolves a RoleResolvable to a Role object.
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | The role resolvable to resolve |
Resolves a RoleResolvable to a Role id.
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | The role resolvable to resolve |
Sets the new position of the role.
Example
Name | Type | Optional | Description |
---|---|---|---|
role | RoleResolvable | No | The role to change the position of |
position | number | No | The new position for the role |
options | SetRolePositionOptions | Yes | Options for setting the position |
Batch-updates the guild's role positions
Example
Name | Type | Optional | Description |
---|---|---|---|
rolePositions | readonly RolePosition[] | No | Role positions to update |