Preview environment

class GuildMemberRoleManager

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
cache : Collection<Snowflake, Role>

The cache of items for this manager.

Inherited from: DataManager

readonly
client : Client

The client that instantiated this Manager

Inherited from: BaseManager

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
holds : Constructable<Role>

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

member : GuildMember

The GuildMember this manager belongs to

readonly
premiumSubscriberRole : Role | null

The premium subscriber role of the guild, if present on the member

Adds a role (or multiple roles) to the member.

remove() : Promise<GuildMember>

Removes a role (or multiple roles) from the member.

resolve(
idOrInstance: Holds
) : Holds

Resolves a data entry to a data Object.

Returns: An instance from this Manager

resolveId(
idOrInstance: Key | Holds
) : Key

Resolves a data entry to an instance id.

Sets the roles applied to the member.

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);

valueOf() : Collection<Snowflake, Role>

Inherited from: DataManager