From ae0a785c6256d6a1e131335d14c9cc1e3dd18eca Mon Sep 17 00:00:00 2001 From: Bsian Date: Tue, 21 Dec 2021 00:05:35 +0000 Subject: [PATCH 1/3] Parse premiumSince date --- lib/structures/Member.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/Member.js b/lib/structures/Member.js index 4085b36a6..d88d270fc 100644 --- a/lib/structures/Member.js +++ b/lib/structures/Member.js @@ -81,7 +81,7 @@ class Member extends Base { this.activities = data.activities; } if(data.premium_since !== undefined) { - this.premiumSince = data.premium_since; + this.premiumSince = Date.parse(data.premium_since); } if(data.hasOwnProperty("mute") && this.guild) { const state = this.guild.voiceStates.get(this.id); From b2a90ea390bf3f74cec6772cc29956d31d8a3391 Mon Sep 17 00:00:00 2001 From: bsian03 Date: Tue, 21 Dec 2021 00:33:43 +0000 Subject: [PATCH 2/3] Nullable premiumSince --- lib/structures/Member.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/Member.js b/lib/structures/Member.js index d88d270fc..e76e90595 100644 --- a/lib/structures/Member.js +++ b/lib/structures/Member.js @@ -81,7 +81,7 @@ class Member extends Base { this.activities = data.activities; } if(data.premium_since !== undefined) { - this.premiumSince = Date.parse(data.premium_since); + this.premiumSince = data.premium_since === null ? null : Date.parse(data.premium_since); } if(data.hasOwnProperty("mute") && this.guild) { const state = this.guild.voiceStates.get(this.id); From f6d4cb9f77a0c9b081275e6c759fb4bedf24504f Mon Sep 17 00:00:00 2001 From: bsian03 Date: Fri, 27 May 2022 16:09:02 +0100 Subject: [PATCH 3/3] premiumSince is nullable and optional --- index.d.ts | 4 ++-- lib/gateway/Shard.js | 2 +- lib/structures/Member.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 9aedba5ee..01314a603 100644 --- a/index.d.ts +++ b/index.d.ts @@ -651,7 +651,7 @@ declare namespace Eris { avatar: string | null; nick: string | null; pending?: boolean; - premiumSince: number; + premiumSince?: number | null; roles: string[]; } interface OldMessage { @@ -3043,7 +3043,7 @@ declare namespace Eris { /** @deprecated */ permission: Permission; permissions: Permission; - premiumSince: number; + premiumSince?: number | null; roles: string[]; staticAvatarURL: string; status?: Status; diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js index 655ad14c5..2e87f3f24 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -1160,7 +1160,7 @@ class Shard extends EventEmitter { * @prop {String?} oldMember.avatar The hash of the member's guild avatar, or null if no guild avatar * @prop {Array} oldMember.roles An array of role IDs this member is a part of * @prop {String?} oldMember.nick The server nickname of the member - * @prop {Number} oldMember.premiumSince Timestamp of when the member boosted the guild + * @prop {Number?} oldMember.premiumSince Timestamp of when the member boosted the guild * @prop {Boolean?} oldMember.pending Whether the member has passed the guild's Membership Screening requirements */ this.emit("guildMemberUpdate", guild, member, oldMember); diff --git a/lib/structures/Member.js b/lib/structures/Member.js index e76e90595..93eb5a7d7 100644 --- a/lib/structures/Member.js +++ b/lib/structures/Member.js @@ -34,7 +34,7 @@ const VoiceState = require("./VoiceState"); * @prop {Boolean?} pending Whether the member has passed the guild's Membership Screening requirements * @prop {Permission} permission [DEPRECATED] The guild-wide permissions of the member. Use Member#permissions instead * @prop {Permission} permissions The guild-wide permissions of the member -* @prop {Number} premiumSince Timestamp of when the member boosted the guild +* @prop {Number?} premiumSince Timestamp of when the member boosted the guild * @prop {Array} roles An array of role IDs this member is a part of * @prop {String} staticAvatarURL The URL of the user's avatar (always a JPG) * @prop {String} status The member's status. Either "online", "idle", "dnd", or "offline"