Skip to content

Commit

Permalink
Add TextChannel#setNSFW method (#2050)
Browse files Browse the repository at this point in the history
* Add TextChannel#setNSFW method

* Doesn't look like anything to me

* butts
  • Loading branch information
Gawdl3y authored Oct 27, 2017
1 parent cd54e93 commit 0fc9459
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions src/structures/TextChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>>}
Expand Down

0 comments on commit 0fc9459

Please # to comment.