mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
added Guild#setExplicitContentFilter (#1583)
This commit is contained in:
@@ -497,6 +497,7 @@ class Guild {
|
|||||||
* @property {string} [name] The name of the guild
|
* @property {string} [name] The name of the guild
|
||||||
* @property {string} [region] The region of the guild
|
* @property {string} [region] The region of the guild
|
||||||
* @property {number} [verificationLevel] The verification level 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 {ChannelResolvable} [afkChannel] The AFK channel of the guild
|
||||||
* @property {number} [afkTimeout] The AFK timeout of the guild
|
* @property {number} [afkTimeout] The AFK timeout of the guild
|
||||||
* @property {Base64Resolvable} [icon] The icon of the guild
|
* @property {Base64Resolvable} [icon] The icon of the guild
|
||||||
@@ -518,7 +519,28 @@ class Guild {
|
|||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
edit(data) {
|
edit(data) {
|
||||||
return this.client.rest.methods.updateGuild(this, data);
|
const _data = {};
|
||||||
|
if (data.name) _data.name = data.name;
|
||||||
|
if (data.region) _data.region = data.region;
|
||||||
|
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.rest.methods.updateGuild(this, _data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit the level of the explicit content filter.
|
||||||
|
* @param {number} explicitContentFilter The new level of the explicit content filter
|
||||||
|
* @returns {Promise<Guild>}
|
||||||
|
*/
|
||||||
|
setExplicitContentFilter(explicitContentFilter) {
|
||||||
|
return this.edit({ explicitContentFilter });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user