mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +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 = {};
|
||||
data.name = (_data.name || channel.name).trim();
|
||||
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.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined);
|
||||
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 {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 channel
|
||||
*/
|
||||
|
||||
@@ -62,6 +62,16 @@ class TextChannel extends GuildChannel {
|
||||
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.
|
||||
* @param {string} name The name of the webhook
|
||||
@@ -85,26 +95,26 @@ class TextChannel extends GuildChannel {
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendFiles() {}
|
||||
sendCode() {}
|
||||
fetchMessage() {}
|
||||
fetchMessages() {}
|
||||
fetchPinnedMessages() {}
|
||||
search() {}
|
||||
startTyping() {}
|
||||
stopTyping() {}
|
||||
get typing() {}
|
||||
get typingCount() {}
|
||||
createCollector() {}
|
||||
createMessageCollector() {}
|
||||
awaitMessages() {}
|
||||
bulkDelete() {}
|
||||
acknowledge() {}
|
||||
_cacheMessage() {}
|
||||
send() { }
|
||||
sendMessage() { }
|
||||
sendEmbed() { }
|
||||
sendFile() { }
|
||||
sendFiles() { }
|
||||
sendCode() { }
|
||||
fetchMessage() { }
|
||||
fetchMessages() { }
|
||||
fetchPinnedMessages() { }
|
||||
search() { }
|
||||
startTyping() { }
|
||||
stopTyping() { }
|
||||
get typing() { }
|
||||
get typingCount() { }
|
||||
createCollector() { }
|
||||
createMessageCollector() { }
|
||||
awaitMessages() { }
|
||||
bulkDelete() { }
|
||||
acknowledge() { }
|
||||
_cacheMessage() { }
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(TextChannel, true);
|
||||
|
||||
Reference in New Issue
Block a user