mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 05:23:31 +01:00
feat(GuildChannel): add setNSFW method
Backported from commit: 0fc9459450
PR: #2050
This commit is contained in:
@@ -335,6 +335,7 @@ class RESTMethods {
|
|||||||
const data = {};
|
const data = {};
|
||||||
data.name = (_data.name || channel.name).trim();
|
data.name = (_data.name || channel.name).trim();
|
||||||
data.topic = typeof _data.topic === 'undefined' ? channel.topic : _data.topic;
|
data.topic = typeof _data.topic === 'undefined' ? channel.topic : _data.topic;
|
||||||
|
data.nsfw = typeof _data.nsfw === 'undefined' ? channel.nsfw : _data.nsfw;
|
||||||
data.position = _data.position || channel.position;
|
data.position = _data.position || channel.position;
|
||||||
data.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined);
|
data.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined);
|
||||||
data.user_limit = typeof _data.userLimit !== 'undefined' ? _data.userLimit : channel.userLimit;
|
data.user_limit = typeof _data.userLimit !== 'undefined' ? _data.userLimit : channel.userLimit;
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ class GuildChannel extends Channel {
|
|||||||
* @property {string} [name] The name of the channel
|
* @property {string} [name] The name of the channel
|
||||||
* @property {number} [position] The position of the channel
|
* @property {number} [position] The position of the channel
|
||||||
* @property {string} [topic] The topic of the text channel
|
* @property {string} [topic] The topic of the text channel
|
||||||
|
* @property {boolean} [nsfw] Whether the channel is NSFW
|
||||||
* @property {number} [bitrate] The bitrate of the voice channel
|
* @property {number} [bitrate] The bitrate of the voice channel
|
||||||
* @property {number} [userLimit] The user limit of the channel
|
* @property {number} [userLimit] The user limit of the channel
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,6 +62,16 @@ class TextChannel extends GuildChannel {
|
|||||||
return this.client.rest.methods.getChannelWebhooks(this);
|
return this.client.rest.methods.getChannelWebhooks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this channel is flagged as NSFW.
|
||||||
|
* @param {boolean} nsfw Whether the channel should be considered NSFW
|
||||||
|
* @param {string} [reason] Reason for changing the channel's NSFW flag
|
||||||
|
* @returns {Promise<TextChannel>}
|
||||||
|
*/
|
||||||
|
setNSFW(nsfw, reason) {
|
||||||
|
return this.edit({ nsfw }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a webhook for the channel.
|
* Create a webhook for the channel.
|
||||||
* @param {string} name The name of the webhook
|
* @param {string} name The name of the webhook
|
||||||
|
|||||||
Reference in New Issue
Block a user