@@ -90,6 +90,16 @@ class GuildMember extends Base {
|
|||||||
} else if (typeof this.avatar !== 'string') {
|
} else if (typeof this.avatar !== 'string') {
|
||||||
this.avatar = null;
|
this.avatar = null;
|
||||||
}
|
}
|
||||||
|
if ('banner' in data) {
|
||||||
|
/**
|
||||||
|
* The guild member's banner hash.
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.banner = data.banner;
|
||||||
|
} else {
|
||||||
|
this.banner ??= null;
|
||||||
|
}
|
||||||
|
|
||||||
if ('joined_at' in data) this.joinedTimestamp = new Date(data.joined_at).getTime();
|
if ('joined_at' in data) this.joinedTimestamp = new Date(data.joined_at).getTime();
|
||||||
if ('premium_since' in data) {
|
if ('premium_since' in data) {
|
||||||
this.premiumSinceTimestamp = data.premium_since ? new Date(data.premium_since).getTime() : null;
|
this.premiumSinceTimestamp = data.premium_since ? new Date(data.premium_since).getTime() : null;
|
||||||
@@ -185,6 +195,17 @@ class GuildMember extends Base {
|
|||||||
return this.client.rest.cdn.GuildMemberAvatar(this.guild.id, this.id, this.avatar, format, size, dynamic);
|
return this.client.rest.cdn.GuildMemberAvatar(this.guild.id, this.id, this.avatar, format, size, dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to the member's banner.
|
||||||
|
* @param {ImageURLOptions} [options={}] Options for the banner URL
|
||||||
|
* @returns {?string}
|
||||||
|
*/
|
||||||
|
bannerURL({ format, size, dynamic } = {}) {
|
||||||
|
return (
|
||||||
|
this.banner && this.client.rest.cdn.GuildMemberBanner(this.guild.id, this.id, this.banner, format, size, dynamic)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to the member's guild avatar if they have one.
|
* A link to the member's guild avatar if they have one.
|
||||||
* Otherwise, a link to their {@link User#displayAvatarURL} will be returned.
|
* Otherwise, a link to their {@link User#displayAvatarURL} will be returned.
|
||||||
@@ -195,6 +216,16 @@ class GuildMember extends Base {
|
|||||||
return this.avatarURL(options) ?? this.user.displayAvatarURL(options);
|
return this.avatarURL(options) ?? this.user.displayAvatarURL(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to the member's guild banner if they have one.
|
||||||
|
* Otherwise, a link to their {@link User#bannerURL} will be returned.
|
||||||
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
||||||
|
* @returns {?string}
|
||||||
|
*/
|
||||||
|
displayBannerURL(options) {
|
||||||
|
return this.bannerURL(options) ?? this.user.bannerURL(options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time this member joined the guild
|
* The time this member joined the guild
|
||||||
* @type {?Date}
|
* @type {?Date}
|
||||||
@@ -484,6 +515,7 @@ class GuildMember extends Base {
|
|||||||
this.joinedTimestamp === member.joinedTimestamp &&
|
this.joinedTimestamp === member.joinedTimestamp &&
|
||||||
this.nickname === member.nickname &&
|
this.nickname === member.nickname &&
|
||||||
this.avatar === member.avatar &&
|
this.avatar === member.avatar &&
|
||||||
|
this.banner === member.banner &&
|
||||||
this.pending === member.pending &&
|
this.pending === member.pending &&
|
||||||
this.communicationDisabledUntilTimestamp === member.communicationDisabledUntilTimestamp &&
|
this.communicationDisabledUntilTimestamp === member.communicationDisabledUntilTimestamp &&
|
||||||
this.flags.equals(member.flags) &&
|
this.flags.equals(member.flags) &&
|
||||||
@@ -511,7 +543,9 @@ class GuildMember extends Base {
|
|||||||
roles: true,
|
roles: true,
|
||||||
});
|
});
|
||||||
json.avatarURL = this.avatarURL();
|
json.avatarURL = this.avatarURL();
|
||||||
|
json.bannerURL = this.bannerURL();
|
||||||
json.displayAvatarURL = this.displayAvatarURL();
|
json.displayAvatarURL = this.displayAvatarURL();
|
||||||
|
json.displayBannerURL = this.displayBannerURL();
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
typings/index.d.ts
vendored
3
typings/index.d.ts
vendored
@@ -1687,6 +1687,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
|
|||||||
private constructor(client: Client, data: RawGuildMemberData, guild: Guild);
|
private constructor(client: Client, data: RawGuildMemberData, guild: Guild);
|
||||||
private _roles: Snowflake[];
|
private _roles: Snowflake[];
|
||||||
public avatar: string | null;
|
public avatar: string | null;
|
||||||
|
public banner: string | null;
|
||||||
public readonly bannable: boolean;
|
public readonly bannable: boolean;
|
||||||
/** @deprecated This will be removed in the next major version, see https://github.com/discordjs/discord.js/issues/7091 */
|
/** @deprecated This will be removed in the next major version, see https://github.com/discordjs/discord.js/issues/7091 */
|
||||||
public deleted: boolean;
|
public deleted: boolean;
|
||||||
@@ -1714,6 +1715,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
|
|||||||
public user: User;
|
public user: User;
|
||||||
public readonly voice: VoiceState;
|
public readonly voice: VoiceState;
|
||||||
public avatarURL(options?: ImageURLOptions): string | null;
|
public avatarURL(options?: ImageURLOptions): string | null;
|
||||||
|
public bannerURL(options?: ImageURLOptions): string | null;
|
||||||
public ban(options?: BanOptions): Promise<GuildMember>;
|
public ban(options?: BanOptions): Promise<GuildMember>;
|
||||||
public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
|
public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
|
||||||
public timeout(timeout: number | null, reason?: string): Promise<GuildMember>;
|
public timeout(timeout: number | null, reason?: string): Promise<GuildMember>;
|
||||||
@@ -1721,6 +1723,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
|
|||||||
public createDM(force?: boolean): Promise<DMChannel>;
|
public createDM(force?: boolean): Promise<DMChannel>;
|
||||||
public deleteDM(): Promise<DMChannel>;
|
public deleteDM(): Promise<DMChannel>;
|
||||||
public displayAvatarURL(options?: ImageURLOptions): string;
|
public displayAvatarURL(options?: ImageURLOptions): string;
|
||||||
|
public displayBannerURL(options?: ImageURLOptions): string | null;
|
||||||
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
|
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
|
||||||
public isCommunicationDisabled(): this is GuildMember & {
|
public isCommunicationDisabled(): this is GuildMember & {
|
||||||
communicationDisabledUntilTimestamp: number;
|
communicationDisabledUntilTimestamp: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user