mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Add parent, nsfw, bitrate, and userLimit options to GuildChannel.clone() (#2259)
* Add parent, nsfw, bitrate, and userLimit options to GuildChannel.clone() * fix lint
This commit is contained in:
@@ -407,11 +407,23 @@ class GuildChannel extends Channel {
|
||||
* @param {boolean} [options.withPermissions=true] Whether to clone the channel with this channel's
|
||||
* permission overwrites
|
||||
* @param {boolean} [options.withTopic=true] Whether to clone the channel with this channel's topic
|
||||
* @param {boolean} [options.nsfw=this.nsfw] Whether the new channel is nsfw (only text)
|
||||
* @param {number} [options.bitrate=this.bitrate] Bitrate of the new channel in bits (only voice)
|
||||
* @param {number} [options.userLimit=this.userLimit] Maximum amount of users allowed in the new channel (only voice)
|
||||
* @param {ChannelResolvable} [options.parent=this.parent] The parent of the new channel
|
||||
* @param {string} [options.reason] Reason for cloning this channel
|
||||
* @returns {Promise<GuildChannel>}
|
||||
*/
|
||||
clone({ name = this.name, withPermissions = true, withTopic = true, reason } = {}) {
|
||||
const options = { overwrites: withPermissions ? this.permissionOverwrites : [], reason, type: this.type };
|
||||
clone({ name = this.name, withPermissions = true, withTopic = true, nsfw, parent, bitrate, userLimit, reason } = {}) {
|
||||
const options = {
|
||||
overwrites: withPermissions ? this.permissionOverwrites : [],
|
||||
nsfw: typeof nsfw === 'undefined' ? this.nsfw : nsfw,
|
||||
parent: parent || this.parent,
|
||||
bitrate: bitrate || this.bitrate,
|
||||
userLimit: userLimit || this.userLimit,
|
||||
reason,
|
||||
type: this.type,
|
||||
};
|
||||
return this.guild.channels.create(name, options)
|
||||
.then(channel => withTopic ? channel.setTopic(this.topic) : channel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user