From 2974f72e94f3798215eee1f2d16e115c27679e54 Mon Sep 17 00:00:00 2001 From: Khaaz Date: Thu, 25 Mar 2021 00:58:15 +0100 Subject: [PATCH] Fix toJSON() consistency (#1032) --- lib/structures/Base.js | 1 + lib/structures/Guild.js | 9 +++++++++ lib/structures/GuildPreview.js | 13 ++++++------- lib/structures/Member.js | 2 +- lib/structures/Message.js | 9 +++++++++ lib/structures/User.js | 2 ++ lib/structures/VoiceState.js | 2 +- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/lib/structures/Base.js b/lib/structures/Base.js index 64d56b849..ec4f0e187 100644 --- a/lib/structures/Base.js +++ b/lib/structures/Base.js @@ -32,6 +32,7 @@ class Base { const json = {}; if(this.id) { json.id = this.id; + json.createdAt = this.createdAt; } for(const prop of props) { const value = this[prop]; diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index 04ba9db9c..addc4bd02 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -918,6 +918,8 @@ class Guild extends Base { "afkChannelID", "afkTimeout", "applicationID", + "approximateMemberCount", + "approximatePresenceCount", "autoRemoved", "banner", "categories", @@ -934,6 +936,7 @@ class Guild extends Base { "large", "maxMembers", "maxPresences", + "maxVideoChannelUsers", "memberCount", "members", "mfaLevel", @@ -944,12 +947,18 @@ class Guild extends Base { "premiumTier", "primaryCategory", "primaryCategoryID", + "publicUpdatesChannelID", "region", "roles", + "rulesChannelID", "splash", + "systemChannelFlags", + "systemChannelID", "unavailable", "vanityURL", "verificationLevel", + "widgetChannelID", + "widgetEnabled", ...props ]); } diff --git a/lib/structures/GuildPreview.js b/lib/structures/GuildPreview.js index 98530808f..8b79731d9 100644 --- a/lib/structures/GuildPreview.js +++ b/lib/structures/GuildPreview.js @@ -77,16 +77,15 @@ class GuildPreview extends Base { toJSON(props = []) { return super.toJSON([ - "id", - "name", - "icon", - "description", - "splash", - "discoverySplash", - "features", "approximateMemberCount", "approximatePresenceCount", + "description", + "discoverySplash", "emojis", + "features", + "icon", + "name", + "splash", ...props ]); } diff --git a/lib/structures/Member.js b/lib/structures/Member.js index e817a4278..a0e116c7d 100644 --- a/lib/structures/Member.js +++ b/lib/structures/Member.js @@ -231,11 +231,11 @@ class Member extends Base { "game", "joinedAt", "nick", + "premiumSince", "roles", "status", "user", "voiceState", - "premiumSince", ...props ]); } diff --git a/lib/structures/Message.js b/lib/structures/Message.js index 06b9b733d..e0cbf7709 100644 --- a/lib/structures/Message.js +++ b/lib/structures/Message.js @@ -442,20 +442,29 @@ class Message extends Base { toJSON(props = []) { return super.toJSON([ + "activity", + "application", "attachments", "author", + "channel", "content", "editedTimestamp", "embeds", + "flags", + "guildID", "hit", + "member", "mentionEveryone", "mentions", + "messageReference", "pinned", "reactions", + "referencedMesssage", "roleMentions", "timestamp", "tts", "type", + "webhookID", ...props ]); } diff --git a/lib/structures/User.js b/lib/structures/User.js index a87a1bfd2..72358a755 100644 --- a/lib/structures/User.js +++ b/lib/structures/User.js @@ -135,6 +135,8 @@ class User extends Base { "avatar", "bot", "discriminator", + "publicFlags", + "system", "username", ...props ]); diff --git a/lib/structures/VoiceState.js b/lib/structures/VoiceState.js index 78b6e0c07..1c636feae 100644 --- a/lib/structures/VoiceState.js +++ b/lib/structures/VoiceState.js @@ -63,8 +63,8 @@ class VoiceState extends Base { "channelID", "deaf", "mute", - "selfMute", "selfDeaf", + "selfMute", "selfStream", "selfVideo", "sessionID",