mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Add TextChannel#setNSFW method (#2050)
* Add TextChannel#setNSFW method * Doesn't look like anything to me * butts
This commit is contained in:
committed by
GitHub
parent
cd54e9317f
commit
0fc9459450
@@ -248,6 +248,7 @@ class GuildChannel extends Channel {
|
||||
* @property {string} [name] The name of the channel
|
||||
* @property {number} [position] The position of the 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} [userLimit] The user limit of the voice channel
|
||||
* @property {Snowflake} [parentID] The parent ID of the channel
|
||||
@@ -290,6 +291,7 @@ class GuildChannel extends Channel {
|
||||
data: {
|
||||
name: (data.name || this.name).trim(),
|
||||
topic: data.topic,
|
||||
nsfw: data.nsfw,
|
||||
bitrate: data.bitrate || (this.bitrate ? this.bitrate * 1000 : undefined),
|
||||
user_limit: data.userLimit != null ? data.userLimit : this.userLimit, // eslint-disable-line eqeqeq
|
||||
parent_id: data.parentID,
|
||||
|
||||
@@ -38,6 +38,16 @@ class TextChannel extends GuildChannel {
|
||||
if (data.messages) for (const message of data.messages) this.messages.create(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all webhooks for the channel.
|
||||
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
||||
|
||||
Reference in New Issue
Block a user