mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
GuildMemberRoleManager: add role that sets the role icon/emoji (#6768)
Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
@@ -47,6 +47,17 @@ class GuildMemberRoleManager extends DataManager {
|
||||
return hoistedRoles.reduce((prev, role) => (!prev || role.comparePositionTo(prev) > 0 ? role : prev));
|
||||
}
|
||||
|
||||
/**
|
||||
* The role of the member used to set their role icon
|
||||
* @type {?Role}
|
||||
* @readonly
|
||||
*/
|
||||
get icon() {
|
||||
const iconRoles = this.cache.filter(role => role.icon || role.unicodeEmoji);
|
||||
if (!iconRoles.size) return null;
|
||||
return iconRoles.reduce((prev, role) => (role.comparePositionTo(prev) > 0 ? role : prev));
|
||||
}
|
||||
|
||||
/**
|
||||
* The role of the member used to set their color
|
||||
* @type {?Role}
|
||||
|
||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -2751,6 +2751,7 @@ export class GuildStickerManager extends CachedManager<Snowflake, Sticker, Stick
|
||||
export class GuildMemberRoleManager extends DataManager<Snowflake, Role, RoleResolvable> {
|
||||
private constructor(member: GuildMember);
|
||||
public readonly hoist: Role | null;
|
||||
public readonly icon: Role | null;
|
||||
public readonly color: Role | null;
|
||||
public readonly highest: Role;
|
||||
public readonly premiumSubscriberRole: Role | null;
|
||||
|
||||
Reference in New Issue
Block a user