Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate guild.nsfw in favour of nsfwLevel #1207

Merged
merged 2 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1940,7 +1943,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