From 4da191d10b705cd4bef7788cc6371e58cd1fe69f Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 22 May 2021 22:31:42 +0100 Subject: [PATCH 1/2] Deprecate guild.nsfw in favour of nsfwLevel --- index.d.ts | 11 +++++++++++ lib/gateway/Shard.js | 4 +++- lib/structures/Guild.js | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index aec9f5dcc..7851033ce 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; @@ -1124,6 +1127,12 @@ declare namespace Eris { SYNC_GUILD: 12; SYNC_CALL: 13; }; + GuildNSFWLevel: { + DEFAULT: 0; + EXPLICIT: 1; + SAFE: 2; + AGE_RESTRICTED: 3; + } ImageFormats: ["jpg", "jpeg", "png", "webp", "gif"]; ImageSizeBoundaries: { MAXIMUM: 4096; @@ -1940,7 +1949,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 958ab0549..93bcd75a2 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() { From 1b3a3048e7a6b2c5b7f25601a39a4b4a6d925d59 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 22 May 2021 22:34:54 +0100 Subject: [PATCH 2/2] gfdi --- index.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7851033ce..4b8a5c60d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1127,12 +1127,6 @@ declare namespace Eris { SYNC_GUILD: 12; SYNC_CALL: 13; }; - GuildNSFWLevel: { - DEFAULT: 0; - EXPLICIT: 1; - SAFE: 2; - AGE_RESTRICTED: 3; - } ImageFormats: ["jpg", "jpeg", "png", "webp", "gif"]; ImageSizeBoundaries: { MAXIMUM: 4096;