GuildMemberRoleManager
classe · Source
Manages API methods for roles of a GuildMember and stores their cache.
Extends: DataManager
Properties
member
The GuildMember this manager belongs to Source
guild
The Guild this manager belongs to Source
cache
The roles of this member Source
hoist
The role of the member used to hoist them in a separate category in the users list Source
icon
The role of the member used to set their role icon Source
color
The role of the member used to set their color Source
highest
The role of the member with the highest position Source
premiumSubscriberRole
The premium subscriber role of the guild, if present on the member Source
botRole
The managed role this member created when joining the guild, if any Only ever available on bots Source
holds
The data structure belonging to this manager. Source
client
The client that instantiated this Manager Source
Methods
add
Adds a role (or multiple roles) to the member.
Uses the idempotent PUT route for singular roles, otherwise PATCHes the underlying guild member Parameters
| Name | Type | Description |
|---|---|---|
roleOrRoles | RoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role> | The role or roles to add |
reason? | string | Reason for adding the role(s) |
Returns: Promise<GuildMember>Source
remove
Removes a role (or multiple roles) from the member.
Uses the idempotent DELETE route for singular roles, otherwise PATCHes the underlying guild member Parameters
| Name | Type | Description |
|---|---|---|
roleOrRoles | RoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role> | The role or roles to remove |
reason? | string | Reason for removing the role(s) |
Returns: Promise<GuildMember>Source
set
Sets the roles applied to the member. Parameters
| Name | Type | Description |
|---|---|---|
roles | Collection<Snowflake, Role> | Array<RoleResolvable> | The roles or role ids to apply |
reason? | string | Reason for applying the roles |
Returns: Promise<GuildMember>
// Set the member's roles to a single role
guildMember.roles.set(['391156570408615936'])
.then(console.log)
.catch(console.error);// Remove all the roles from a member
guildMember.roles.set([])
.then(member => console.log(`Member roles is now of ${member.roles.cache.size} size`))
.catch(console.error);resolve
Resolves a data entry to a data Object. Parameters
| Name | Type | Description |
|---|---|---|
idOrInstance | string | Object | The id or instance of something in this Manager |
Returns: Object — An instance from this Manager Source
resolveId
Resolves a data entry to an instance id. Parameters
| Name | Type | Description |
|---|---|---|
idOrInstance | string | Object | The id or instance of something in this Manager |
Returns: SnowflakeSource