Members
(private, readonly) _roles :Collection.<Snowflake, Role>
The filtered collection of roles of the member
Type:
(readonly) cache :Collection.<Snowflake, Role>
The roles of this member
Type:
(readonly, nullable) color :Role
The role of the member used to set their color
Type:
guild :Guild
The Guild this manager belongs to
Type:
(readonly) highest :Role
The role of the member with the highest position
Type:
(readonly, nullable) hoist :Role
The role of the member used to hoist them in a separate category in the users list
Type:
member :GuildMember
The GuildMember this manager belongs to
Type:
Methods
add(roleOrRoles, reasonopt) → {Promise.<GuildMember>}
Adds a role (or multiple roles) to the member.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roleOrRoles |
RoleResolvable | Array.<RoleResolvable> | Collection.<Snowflake, Role> | The role or roles to add | |
reason |
string |
<optional> |
Reason for adding the role(s) |
Returns:
- Type
- Promise.<GuildMember>
remove(roleOrRoles, reasonopt) → {Promise.<GuildMember>}
Removes a role (or multiple roles) from the member.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roleOrRoles |
RoleResolvable | Array.<RoleResolvable> | Collection.<Snowflake, Role> | The role or roles to remove | |
reason |
string |
<optional> |
Reason for removing the role(s) |
Returns:
- Type
- Promise.<GuildMember>
set(roles, reasonopt) → {Promise.<GuildMember>}
Sets the roles applied to the member.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roles |
Collection.<Snowflake, Role> | Array.<RoleResolvable> | The roles or role IDs to apply | |
reason |
string |
<optional> |
Reason for applying the roles |
Returns:
- Type
- Promise.<GuildMember>
Examples
// 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);