Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Member): Parse Member#premiumSince to timestamp #1318

Merged
merged 3 commits into from
May 27, 2022
Merged
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
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ declare namespace Eris {
avatar: string | null;
nick: string | null;
pending?: boolean;
premiumSince: number;
premiumSince?: number | null;
roles: string[];
}
interface OldMessage {
Expand Down Expand Up @@ -3043,7 +3043,7 @@ declare namespace Eris {
/** @deprecated */
permission: Permission;
permissions: Permission;
premiumSince: number;
premiumSince?: number | null;
roles: string[];
staticAvatarURL: string;
status?: Status;
Expand Down
2 changes: 1 addition & 1 deletion lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>} 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);
Expand Down
4 changes: 2 additions & 2 deletions lib/structures/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>} 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"
Expand Down Expand Up @@ -81,7 +81,7 @@ class Member extends Base {
this.activities = data.activities;
}
if(data.premium_since !== undefined) {
this.premiumSince = 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);
Expand Down