A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/discordjs/discord.js/commit/15f7571243d5b206141290478fd5164d299c0850 below:

add `avatarDecorationData` (#10942) · discordjs/discord.js@15f7571 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+41

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+41

-1

lines changed Original file line number Diff line number Diff line change

@@ -122,6 +122,20 @@ class GuildMember extends Base {

122 122

} else {

123 123

this.flags ??= new GuildMemberFlagsBitField().freeze();

124 124

}

125 + 126 +

if (data.avatar_decoration_data) {

127 +

/**

128 +

* The member avatar decoration's data

129 +

*

130 +

* @type {?AvatarDecorationData}

131 +

*/

132 +

this.avatarDecorationData = {

133 +

asset: data.avatar_decoration_data.asset,

134 +

skuId: data.avatar_decoration_data.sku_id,

135 +

};

136 +

} else {

137 +

this.avatarDecorationData = null;

138 +

}

125 139

}

126 140 127 141

_clone() {

@@ -166,6 +180,15 @@ class GuildMember extends Base {

166 180

return this.avatar && this.client.rest.cdn.guildMemberAvatar(this.guild.id, this.id, this.avatar, options);

167 181

}

168 182 183 +

/**

184 +

* A link to the member's avatar decoration.

185 +

*

186 +

* @returns {?string}

187 +

*/

188 +

avatarDecorationURL() {

189 +

return this.avatarDecorationData ? this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset) : null;

190 +

}

191 + 169 192

/**

170 193

* A link to the member's banner.

171 194

* @param {ImageURLOptions} [options={}] Options for the banner URL

@@ -195,6 +218,16 @@ class GuildMember extends Base {

195 218

return this.bannerURL(options) ?? this.user.bannerURL(options);

196 219

}

197 220 221 +

/**

222 +

* A link to the member's guild avatar decoration if they have one.

223 +

* Otherwise, a link to their {@link User#avatarDecorationURL} will be returned.

224 +

*

225 +

* @returns {?string}

226 +

*/

227 +

displayAvatarDecorationURL() {

228 +

return this.avatarDecorationURL() ?? this.user.avatarDecorationURL();

229 +

}

230 + 198 231

/**

199 232

* The time this member joined the guild

200 233

* @type {?Date}

@@ -499,7 +532,10 @@ class GuildMember extends Base {

499 532

this.communicationDisabledUntilTimestamp === member.communicationDisabledUntilTimestamp &&

500 533

this.flags.bitfield === member.flags.bitfield &&

501 534

(this._roles === member._roles ||

502 -

(this._roles.length === member._roles.length && this._roles.every((role, i) => role === member._roles[i])))

535 +

(this._roles.length === member._roles.length &&

536 +

this._roles.every((role, index) => role === member._roles[index]))) &&

537 +

this.avatarDecorationData?.asset === member.avatarDecorationData?.asset &&

538 +

this.avatarDecorationData?.skuId === member.avatarDecorationData?.skuId

503 539

);

504 540

}

505 541

@@ -525,6 +561,7 @@ class GuildMember extends Base {

525 561

json.bannerURL = this.bannerURL();

526 562

json.displayAvatarURL = this.displayAvatarURL();

527 563

json.displayBannerURL = this.displayBannerURL();

564 +

json.avatarDecorationURL = this.avatarDecorationURL();

528 565

return json;

529 566

}

530 567

}

Original file line number Diff line number Diff line change

@@ -1799,6 +1799,7 @@ export class GuildMember extends Base {

1799 1799

private constructor(client: Client<true>, data: RawGuildMemberData, guild: Guild);

1800 1800

private _roles: Snowflake[];

1801 1801

public avatar: string | null;

1802 +

public avatarDecorationData: AvatarDecorationData | null;

1802 1803

public banner: string | null;

1803 1804

public get bannable(): boolean;

1804 1805

public get dmChannel(): DMChannel | null;

@@ -1826,6 +1827,7 @@ export class GuildMember extends Base {

1826 1827

public user: User;

1827 1828

public get voice(): VoiceState;

1828 1829

public avatarURL(options?: ImageURLOptions): string | null;

1830 +

public avatarDecorationURL(): string | null;

1829 1831

public bannerURL(options?: ImageURLOptions): string | null;

1830 1832

public ban(options?: BanOptions): Promise<GuildMember>;

1831 1833

public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;

@@ -1835,6 +1837,7 @@ export class GuildMember extends Base {

1835 1837

public deleteDM(): Promise<DMChannel>;

1836 1838

public displayAvatarURL(options?: ImageURLOptions): string;

1837 1839

public displayBannerURL(options?: ImageURLOptions): string | null;

1840 +

public displayAvatarDecorationURL(): string | null;

1838 1841

public edit(options: GuildMemberEditOptions): Promise<GuildMember>;

1839 1842

public isCommunicationDisabled(): this is GuildMember & {

1840 1843

communicationDisabledUntilTimestamp: number;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4