GuildMemberRoleManager

export class GuildMemberRoleManager extends DataManager<Snowflake, Role, RoleResolvable>
export class GuildMemberRoleManager extends DataManager<Snowflake, Role, RoleResolvable>
Manages API methods for roles of a GuildMember and stores their cache.
Readonly
botRole:Role | null
The managed role this member created when joining the guild, if any Only ever available on bots
Readonly
The roles of this member
Readonly
client:Client
The client that instantiated this Manager
Readonly
color:Role | null
The role of the member used to set their color
guild:Guild
The Guild this manager belongs to
Readonly
highest:Role
The role of the member with the highest position
Readonly
hoist:Role | null
The role of the member used to hoist them in a separate category in the users list
Readonly
The data structure belonging to this manager.
Inherited from DataManager
Readonly
icon:Role | null
The role of the member used to set their role icon
The GuildMember this manager belongs to
Readonly
premiumSubscriberRole:Role | null
The premium subscriber role of the guild, if present on the member
add(roleOrRoles, reason?):Promise<GuildMember>
Adds a role (or multiple roles) to the member.
NameTypeOptionalDescription
roleOrRolesRoleResolvable | readonly RoleResolvable[] | Collection<Snowflake, Role>NoThe role or roles to add
reasonstringYesReason for adding the role(s)
remove(roleOrRoles, reason?):Promise<GuildMember>
Removes a role (or multiple roles) from the member.
NameTypeOptionalDescription
roleOrRolesRoleResolvable | readonly RoleResolvable[] | Collection<Snowflake, Role>NoThe role or roles to remove
reasonstringYesReason for removing the role(s)
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):Key
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceKey | HoldsNoThe id or instance of something in this Manager
set(roles, reason?):Promise<GuildMember>
Sets the roles applied to the member.
Example
// Set the member's roles to a single role
guildMember.roles.set(['391156570408615936'])
.then(console.log)
.catch(console.error);
// Set the member's roles to a single role
guildMember.roles.set(['391156570408615936'])
.then(console.log)
.catch(console.error);
Example
// 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);
// 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);
NameTypeOptionalDescription
rolesreadonly RoleResolvable[] | Collection<Snowflake, Role>NoThe roles or role ids to apply
reasonstringYesReason for applying the roles