From 21983de3e00b6ae72bb8a41359209f77025a7808 Mon Sep 17 00:00:00 2001 From: Francis Rivard Date: Mon, 23 Aug 2021 16:19:55 +0200 Subject: [PATCH] feat(Guild): Add `Guild#maximumBitrate` getter. (#6455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Antonio Román Co-authored-by: Vlad Frangu --- src/structures/Guild.js | 22 ++++++++++++++++++++++ typings/index.d.ts | 1 + 2 files changed, 23 insertions(+) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 9a8759e73..5a6d06746 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -534,6 +534,28 @@ class Guild extends AnonymousGuild { ); } + /** + * The maximum bitrate available for this guild + * @type {number} + * @readonly + */ + get maximumBitrate() { + if (this.features.includes('VIP_REGIONS')) { + return 384000; + } + + switch (PremiumTiers[this.premiumTier]) { + case PremiumTiers.TIER_1: + return 128000; + case PremiumTiers.TIER_2: + return 256000; + case PremiumTiers.TIER_3: + return 384000; + default: + return 96000; + } + } + /** * Fetches a collection of integrations to this guild. * Resolves with a collection mapping integrations by their ids. diff --git a/typings/index.d.ts b/typings/index.d.ts index 063f229bf..dcad6f235 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -701,6 +701,7 @@ export class Guild extends AnonymousGuild { public readonly widgetChannel: TextChannel | null; public widgetChannelId: Snowflake | null; public widgetEnabled: boolean | null; + public readonly maximumBitrate: number; public createTemplate(name: string, description?: string): Promise; public delete(): Promise; public discoverySplashURL(options?: StaticImageURLOptions): string | null;