From 430a6e3e0327563868d00bc26855b11236c86e3e Mon Sep 17 00:00:00 2001 From: bsian03 Date: Sun, 11 Jul 2021 12:14:44 +0100 Subject: [PATCH] Expose Guild#nsfwLevel, deprecate Guild#nsfw (#1207) --- index.d.ts | 5 +++++ lib/gateway/Shard.js | 4 +++- lib/structures/Guild.js | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2e0d25fa0..af83e38c3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -46,6 +46,7 @@ declare namespace Eris { // Guild type DefaultNotifications = 0 | 1; type ExplicitContentFilter = 0 | 1 | 2; + type NSFWLevel = 0 | 1 | 2 | 3; type PossiblyUncachedGuild = Guild | Uncached; type PremiumTier = 0 | 1 | 2 | 3; type VerificationLevel = 0 | 1 | 2 | 3 | 4; @@ -415,7 +416,9 @@ declare namespace Eris { maxVideoChannelUsers?: number; mfaLevel: MFALevel; name: string; + /** @deprecated */ nsfw: boolean; + nsfwLevel: NSFWLevel; ownerID: string; preferredLocale?: string; premiumSubscriptionCount?: number; @@ -1953,7 +1956,9 @@ declare namespace Eris { members: Collection; mfaLevel: MFALevel; name: string; + /** @deprecated */ nsfw: boolean; + nsfwLevel: NSFWLevel; ownerID: string; preferredLocale: string; premiumSubscriptionCount?: number; diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js index df4710d5c..1f2a509cd 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -1231,6 +1231,7 @@ class Shard extends EventEmitter { mfaLevel: guild.mfaLevel, name: guild.name, nsfw: guild.nsfw, + nsfwLevel: guild.nsfwLevel, ownerID: guild.ownerID, preferredLocale: guild.preferredLocale, premiumSubscriptionCount: guild.premiumSubscriptionCount, @@ -1263,7 +1264,8 @@ class Shard extends EventEmitter { * @prop {Number?} oldGuild.maxVideoChannelUsers The max number of users allowed in a video channel * @prop {Number} oldGuild.mfaLevel The admin 2FA level for the guild. 0 is not required, 1 is required * @prop {String} oldGuild.name The name of the guild - * @prop {Boolean} oldGuild.nsfw Whether the guild is designated as NSFW by Discord + * @prop {Boolean} oldGuild.nsfw [DEPRECATED] Whether the guild is designated as NSFW by Discord + * @prop {Number} oldGuild.nsfwLevel The guild NSFW level designated by Discord * @prop {String} oldGuild.ownerID The ID of the user that is the guild owner * @prop {String} oldGuild.preferredLocale Preferred "COMMUNITY" guild language used in server discovery and notices from Discord * @prop {Number?} oldGuild.premiumSubscriptionCount The total number of users currently boosting this guild diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index c89c927a8..1588bb025 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -45,7 +45,8 @@ const {Permissions} = require("../Constants"); * @prop {Number} memberCount Number of members in the guild * @prop {Collection} members Collection of Members in the guild * @prop {String} name The name of the guild -* @prop {Boolean} nsfw Whether the guild is designated as NSFW by Discord +* @prop {Boolean} nsfw [DEPRECATED] Whether the guild is designated as NSFW by Discord +* @prop {Number} nsfwLevel The guild NSFW level designated by Discord * @prop {String} ownerID The ID of the user that is the guild owner * @prop {String} preferredLocale Preferred "COMMUNITY" guild language used in server discovery and notices from Discord * @prop {Number?} premiumSubscriptionCount The total number of users currently boosting this guild @@ -285,6 +286,9 @@ class Guild extends Base { if(data.nsfw !== undefined) { this.nsfw = data.nsfw; } + if(data.nsfw_level !== undefined) { + this.nsfwLevel = data.nsfw_level; + } } get bannerURL() {