From 8e7d15e49d0b75687d4ae813d8274b7086959004 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:34:24 +0100 Subject: [PATCH] feat: Add `premiumSubscriptionCount` to `InviteGuild` (#7629) --- src/structures/AnonymousGuild.js | 10 ++++++++++ src/structures/Guild.js | 8 -------- typings/index.d.ts | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/structures/AnonymousGuild.js b/src/structures/AnonymousGuild.js index 5415e548550b..963091092d82 100644 --- a/src/structures/AnonymousGuild.js +++ b/src/structures/AnonymousGuild.js @@ -64,6 +64,16 @@ class AnonymousGuild extends BaseGuild { */ this.nsfwLevel = NSFWLevels[data.nsfw_level]; } + + if ('premium_subscription_count' in data) { + /** + * The total number of boosts for this server + * @type {?number} + */ + this.premiumSubscriptionCount = data.premium_subscription_count; + } else { + this.premiumSubscriptionCount ??= null; + } } /** diff --git a/src/structures/Guild.js b/src/structures/Guild.js index c8471e471eae..3a3c184f7cee 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -286,14 +286,6 @@ class Guild extends AnonymousGuild { this.premiumTier = PremiumTiers[data.premium_tier]; } - if ('premium_subscription_count' in data) { - /** - * The total number of boosts for this server - * @type {?number} - */ - this.premiumSubscriptionCount = data.premium_subscription_count; - } - if ('widget_enabled' in data) { /** * Whether widget images are enabled on this guild diff --git a/typings/index.d.ts b/typings/index.d.ts index de4e3f486586..af20f5951153 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -184,6 +184,7 @@ export abstract class AnonymousGuild extends BaseGuild { public banner: string | null; public description: string | null; public nsfwLevel: NSFWLevel; + public premiumSubscriptionCount: number | null; public splash: string | null; public vanityURLCode: string | null; public verificationLevel: VerificationLevel; @@ -905,7 +906,6 @@ export class Guild extends AnonymousGuild { public mfaLevel: MFALevel; public ownerId: Snowflake; public preferredLocale: string; - public premiumSubscriptionCount: number | null; public premiumProgressBarEnabled: boolean; public premiumTier: PremiumTier; public presences: PresenceManager;