Skip to content

Commit

Permalink
Expose Guild#nsfwLevel, deprecate Guild#nsfw (abalabahaha#1207)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 committed Oct 10, 2021
1 parent b29d202 commit 430a6e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -415,7 +416,9 @@ declare namespace Eris {
maxVideoChannelUsers?: number;
mfaLevel: MFALevel;
name: string;
/** @deprecated */
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale?: string;
premiumSubscriptionCount?: number;
Expand Down Expand Up @@ -1953,7 +1956,9 @@ declare namespace Eris {
members: Collection<Member>;
mfaLevel: MFALevel;
name: string;
/** @deprecated */
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale: string;
premiumSubscriptionCount?: number;
Expand Down
4 changes: 3 additions & 1 deletion lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const {Permissions} = require("../Constants");
* @prop {Number} memberCount Number of members in the guild
* @prop {Collection<Member>} 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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 430a6e3

Please sign in to comment.