Skip to content

feat(GuildMember): add avatarDecorationData #10942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 22, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/discord.js/src/structures/GuildMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ class GuildMember extends Base {
} else {
this.flags ??= new GuildMemberFlagsBitField().freeze();
}

if (data.avatar_decoration_data) {
/**
* The member avatar decoration's data
*
* @type {?AvatarDecorationData}
*/
this.avatarDecorationData = {
asset: data.avatar_decoration_data.asset,
skuId: data.avatar_decoration_data.sku_id,
};
} else {
this.avatarDecorationData = null;
}
}

_clone() {
Expand Down Expand Up @@ -181,6 +195,15 @@ class GuildMember extends Base {
return this.avatar && this.client.rest.cdn.guildMemberAvatar(this.guild.id, this.id, this.avatar, options);
}

/**
* A link to the member's avatar decoration.
*
* @returns {?string}
*/
avatarDecorationURL() {
return this.avatarDecorationData ? this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset) : null;
}

/**
* A link to the member's banner.
*
Expand Down Expand Up @@ -560,7 +583,9 @@ class GuildMember extends Base {
this.flags.bitfield === member.flags.bitfield &&
(this._roles === member._roles ||
(this._roles.length === member._roles.length &&
this._roles.every((role, index) => role === member._roles[index])))
this._roles.every((role, index) => role === member._roles[index]))) &&
this.avatarDecorationData?.asset === member.avatarDecorationData?.asset &&
this.avatarDecorationData?.skuId === member.avatarDecorationData?.skuId
);
}

Expand All @@ -587,6 +612,7 @@ class GuildMember extends Base {
json.bannerURL = this.bannerURL();
json.displayAvatarURL = this.displayAvatarURL();
json.displayBannerURL = this.displayBannerURL();
json.avatarDecorationURL = this.avatarDecorationURL();
return json;
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,7 @@ export class GuildMember extends Base {
private constructor(client: Client<true>, data: unknown, guild: Guild);
private readonly _roles: Snowflake[];
public avatar: string | null;
public avatarDecorationData: AvatarDecorationData | null;
public banner: string | null;
public get bannable(): boolean;
public get dmChannel(): DMChannel | null;
Expand Down Expand Up @@ -1623,6 +1624,7 @@ export class GuildMember extends Base {
public user: User;
public get voice(): VoiceState;
public avatarURL(options?: ImageURLOptions): string | null;
public avatarDecorationURL(): string | null;
public bannerURL(options?: ImageURLOptions): string | null;
public ban(options?: BanOptions): Promise<void>;
public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
Expand Down Expand Up @@ -3534,7 +3536,7 @@ export class User extends Base {
public get tag(): string;
public username: string;
public avatarURL(options?: ImageURLOptions): string | null;
public avatarDecorationURL(options?: BaseImageURLOptions): string | null;
public avatarDecorationURL(): string | null;
public bannerURL(options?: ImageURLOptions): string | null | undefined;
public createDM(force?: boolean): Promise<DMChannel>;
public deleteDM(): Promise<DMChannel>;
Expand Down