From e671a010cbb5dd7ca988b78fc4b6ec96f5dd7fd9 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Sun, 25 Jun 2017 00:03:37 +0200 Subject: [PATCH] added Guild#setExplicitContentFilter (#1583) --- src/structures/Guild.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 84ab909b2..e3c6a18d3 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -560,6 +560,7 @@ class Guild { * @property {string} [name] The name of the guild * @property {string} [region] The region of the guild * @property {number} [verificationLevel] The verification level of the guild + * @property {number} [explicitContentFilter] The level of the explicit content filter * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild * @property {number} [afkTimeout] The AFK timeout of the guild * @property {Base64Resolvable} [icon] The icon of the guild @@ -585,16 +586,28 @@ class Guild { const _data = {}; if (data.name) _data.name = data.name; if (data.region) _data.region = data.region; - if (data.verificationLevel) _data.verification_level = Number(data.verificationLevel); + if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel); if (data.afkChannel) _data.afk_channel_id = this.client.resolver.resolveChannel(data.afkChannel).id; if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout); if (data.icon) _data.icon = this.client.resolver.resolveBase64(data.icon); if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id; if (data.splash) _data.splash = this.client.resolver.resolveBase64(data.splash); + if (typeof data.explicitContentFilter !== 'undefined') { + _data.explicit_content_filter = Number(data.explicitContentFilter); + } return this.client.api.guilds(this.id).patch({ data: _data, reason }) .then(newData => this.client.actions.GuildUpdate.handle(newData).updated); } + /** + * Edit the level of the explicit content filter. + * @param {number} explicitContentFilter The new level of the explicit content filter + * @returns {Promise} + */ + setExplicitContentFilter(explicitContentFilter) { + return this.edit({ explicitContentFilter }); + } + /** * Edit the name of the guild. * @param {string} name The new name of the guild