@@ -136,20 +136,34 @@ class User extends Base {
|
||||
this.flags = new UserFlags(data.public_flags);
|
||||
}
|
||||
|
||||
if ('avatar_decoration_data' in data) {
|
||||
if ('avatar_decoration' in data) {
|
||||
/**
|
||||
* The user avatar decoration's hash
|
||||
* @type {?string}
|
||||
* @deprecated Use `avatarDecorationData` instead
|
||||
*/
|
||||
this.avatarDecoration = data.avatar_decoration_data?.asset;
|
||||
/**
|
||||
* The ID of the avatar decoration's SKU
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.avatarDecorationSKUId = data.avatar_decoration_data?.sku_id;
|
||||
this.avatarDecoration = data.avatar_decoration;
|
||||
} else {
|
||||
this.avatarDecoration ??= null;
|
||||
this.avatarDecorationSKUId ??= null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} AvatarDecorationData
|
||||
* @property {string} asset The avatar decoration hash
|
||||
* @property {Snowflake} skuId The id of the avatar decoration's SKU
|
||||
*/
|
||||
|
||||
if (data.avatar_decoration_data) {
|
||||
/**
|
||||
* The user 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;
|
||||
}
|
||||
|
||||
if ('clan' in data && data.clan) {
|
||||
@@ -220,8 +234,10 @@ class User extends Base {
|
||||
* @returns {?string}
|
||||
*/
|
||||
avatarDecorationURL({ format, size } = {}) {
|
||||
if (!this.avatarDecoration) return null;
|
||||
return this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecoration, format, size);
|
||||
if (this.avatarDecorationData) {
|
||||
return this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecorationData.asset, format, size);
|
||||
}
|
||||
return this.avatarDecoration && this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecoration, format, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,7 +360,10 @@ class User extends Base {
|
||||
this.avatar === user.avatar &&
|
||||
this.flags?.bitfield === user.flags?.bitfield &&
|
||||
this.banner === user.banner &&
|
||||
this.accentColor === user.accentColor
|
||||
this.accentColor === user.accentColor &&
|
||||
this.avatarDecoration === user.avatarDecoration &&
|
||||
this.avatarDecorationData?.asset === user.avatarDecorationData?.asset &&
|
||||
this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -364,7 +383,12 @@ class User extends Base {
|
||||
this.avatar === user.avatar &&
|
||||
this.flags?.bitfield === user.public_flags &&
|
||||
('banner' in user ? this.banner === user.banner : true) &&
|
||||
('accent_color' in user ? this.accentColor === user.accent_color : true)
|
||||
('accent_color' in user ? this.accentColor === user.accent_color : true) &&
|
||||
('avatar_decoration' in user ? this.avatarDecoration === user.avatar_decoration : true) &&
|
||||
('avatar_decoration_data' in user
|
||||
? this.avatarDecorationData?.asset === user.avatar_decoration_data?.asset &&
|
||||
this.avatarDecorationData?.skuId === user.avatar_decoration_data?.sku_id
|
||||
: true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
8
typings/index.d.ts
vendored
8
typings/index.d.ts
vendored
@@ -3370,14 +3370,20 @@ export interface UserClan {
|
||||
badge?: string;
|
||||
}
|
||||
|
||||
export interface AvatarDecorationData {
|
||||
asset: string;
|
||||
skuId: Snowflake;
|
||||
}
|
||||
|
||||
export class User extends PartialTextBasedChannel(Base) {
|
||||
protected constructor(client: Client, data: RawUserData);
|
||||
private _equals(user: APIUser): boolean;
|
||||
|
||||
public accentColor: number | null | undefined;
|
||||
public avatar: string | null;
|
||||
/** @deprecated Use {@link User.avatarDecorationData} instead */
|
||||
public avatarDecoration: string | null;
|
||||
public avatarDecorationSKUId: Snowflake | null;
|
||||
public avatarDecorationData: AvatarDecorationData | null;
|
||||
public banner: string | null | undefined;
|
||||
public bannerColor: string | null | undefined;
|
||||
public bot: boolean;
|
||||
|
||||
Reference in New Issue
Block a user