mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat(Guild): add the new nsfw_level property (#5660)
Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: Noel <icrawltogo@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ const {
|
||||
PartialTypes,
|
||||
VerificationLevels,
|
||||
ExplicitContentFilterLevels,
|
||||
NSFWLevels,
|
||||
} = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||
@@ -115,14 +116,6 @@ class Guild extends Base {
|
||||
* @type {number}
|
||||
*/
|
||||
this.shardID = data.shardID;
|
||||
|
||||
if ('nsfw' in data) {
|
||||
/**
|
||||
* Whether the guild is designated as not safe for work
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.nsfw = data.nsfw;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +169,14 @@ class Guild extends Base {
|
||||
*/
|
||||
this.memberCount = data.member_count || this.memberCount;
|
||||
|
||||
if ('nsfw_level' in data) {
|
||||
/**
|
||||
* The NSFW level of this guild
|
||||
* @type {NSFWLevel}
|
||||
*/
|
||||
this.nsfwLevel = NSFWLevels[data.nsfw_level];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the guild is "large" (has more than large_threshold members, 50 by default)
|
||||
* @type {boolean}
|
||||
|
||||
@@ -819,6 +819,16 @@ exports.InteractionResponseTypes = createEnum([
|
||||
'DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE',
|
||||
]);
|
||||
|
||||
/**
|
||||
* NSFW level of a Guild
|
||||
* * DEFAULT
|
||||
* * EXPLICIT
|
||||
* * SAFE
|
||||
* * AGE_RESTRICTED
|
||||
* @typedef {string} NSFWLevel
|
||||
*/
|
||||
exports.NSFWLevels = createEnum(['DEFAULT', 'EXPLICIT', 'SAFE', 'AGE_RESTRICTED']);
|
||||
|
||||
function keyMirror(arr) {
|
||||
let tmp = Object.create(null);
|
||||
for (const value of arr) tmp[value] = value;
|
||||
|
||||
Reference in New Issue
Block a user