fix(guildmember): make pending nullable (#7401)

This commit is contained in:
Almeida
2022-02-09 08:18:50 +00:00
committed by GitHub
parent dd751ae19d
commit fe11ff5f6e
2 changed files with 10 additions and 4 deletions

View File

@@ -43,9 +43,9 @@ class GuildMember extends Base {
/**
* Whether this member has yet to pass the guild's membership gate
* @type {boolean}
* @type {?boolean}
*/
this.pending = false;
this.pending = null;
/**
* The timestamp this member's timeout will be removed
@@ -81,7 +81,13 @@ class GuildMember extends Base {
this.premiumSinceTimestamp = data.premium_since ? Date.parse(data.premium_since) : null;
}
if ('roles' in data) this._roles = data.roles;
this.pending = data.pending ?? false;
if ('pending' in data) {
this.pending = data.pending;
} else if (!this.partial) {
// See https://github.com/discordjs/discord.js/issues/6546 for more info.
this.pending ??= false;
}
if ('communication_disabled_until' in data) {
this.communicationDisabledUntilTimestamp =

View File

@@ -4715,7 +4715,7 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
lastMessageId: undefined;
}
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp'> {}
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
export interface PartialMessage
extends Partialize<Message, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> {}