Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 27 additions & 2 deletions packages/discord.js/src/structures/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class User extends Base {
this.system = null;

this.flags = null;

this.clan = null;

this._patch(data);
}
Expand Down Expand Up @@ -151,6 +153,27 @@ class User extends Base {
} else {
this.avatarDecorationData = null;
}

/**
* @typedef {Object} UserClan
* @property {Snowflake} guildId Identifier of the guild of the tag
* @property {string} badge The badge of the clan
* @property {string} tag The tag of the clan
*/

if (data.clan) {
/**
* The user clan data
* @type {?UserClan}
*/
this.clan = {
guildId: data.clan.identity_guild_id,
badge: data.clan.badge,
tag: data.clan.tag,
};
} else {
this.clan ??= null;
}
}

/**
Expand Down Expand Up @@ -338,7 +361,8 @@ class User extends Base {
this.banner === user.banner &&
this.accentColor === user.accentColor &&
this.avatarDecorationData?.asset === user.avatarDecorationData?.asset &&
this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId
this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId &&
this.clan?.guildId === user.clan?.guildId
);
}

Expand All @@ -363,7 +387,8 @@ class User extends Base {
('avatar_decoration_data' in user
? this.avatarDecorationData?.asset === user.avatar_decoration_data?.asset &&
this.avatarDecorationData?.skuId === user.avatar_decoration_data?.sku_id
: true)
: true) &&
('clan' in user ? this.clan?.guildId === user.clan?.guildId : true)
);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3499,6 +3499,12 @@ export interface AvatarDecorationData {
skuId: Snowflake;
}

export interface UserClan {
guildId: Snowflake;
badge: string;
tag: string;
}

export interface UnfurledMediaItemData {
url: string;
}
Expand All @@ -3517,6 +3523,7 @@ export class User extends Base {
public accentColor: number | null | undefined;
public avatar: string | null;
public avatarDecorationData: AvatarDecorationData | null;
public clan: UserClan | null;
public banner: string | null | undefined;
public bot: boolean;
public get createdAt(): Date;
Expand Down
Loading