RoleManager

export class RoleManager extends CachedManager<Snowflake, Role, RoleResolvable>
export class RoleManager extends CachedManager<Snowflake, Role, RoleResolvable>
Manages API methods for roles and stores their cache.
Readonly
cache:Collection<K, Holds>
The cache of items for this manager.
Inherited from DataManager
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
Readonly
everyone:Role
The @everyone role of the guild
guild:Guild
The guild belonging to this manager
Readonly
highest:Role
The role with the highest position in the cache
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
Readonly
premiumSubscriberRole:Role | null
The premium subscriber role of the guild, if any
botRoleFor(user):Role | null
Gets the managed role a user created when joining the guild, if any Only ever available for bots
Returns
NameTypeOptionalDescription
userUserResolvableNoThe user to access the bot role for
comparePositions(role1, role2):number
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 equal
NameTypeOptionalDescription
role1RoleResolvableNoFirst role to compare
role2RoleResolvableNoSecond role to compare
create(options?):Promise<Role>
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.
NameTypeOptionalDescription
optionsRoleCreateOptionsYesOptions for creating the new role
delete(role, reason?):Promise<void>
Deletes a role.
NameTypeOptionalDescription
roleRoleResolvableNoThe role to delete
reasonstringYesReason for deleting the role
edit(role, options):Promise<Role>
Edits a role of the guild.
NameTypeOptionalDescription
roleRoleResolvableNoThe role to edit
optionsRoleEditOptionsNoThe options to provide
fetch(id, options?):Promise<Role | null>
Obtains a role from Discord, or the role cache if they're already available.
NameTypeOptionalDescription
idSnowflakeNoThe role's id
optionsBaseFetchOptionsYesAdditional options for this fetch
resolve(idOrInstance):Holds
Resolves a data entry to a data Object.
Returns
An instance from this Manager
NameTypeOptionalDescription
idOrInstanceHoldsNoThe id or instance of something in this Manager
resolveId(idOrInstance):K
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceK | HoldsNoThe id or instance of something in this Manager
setPosition(role, position, options?):Promise<Role>
Sets the new position of the role.
NameTypeOptionalDescription
roleRoleResolvableNoThe role to change the position of
positionnumberNoThe new position for the role
optionsSetRolePositionOptionsYesOptions for setting the position
setPositions(rolePositions):Promise<Guild>
Batch-updates the guild's role positions
NameTypeOptionalDescription
rolePositionsreadonly RolePosition[]NoRole positions to update
valueOf():Collection<K, Holds>