From 4fb7e64a39b1889191634f5f60fe9e20ad71ebfe Mon Sep 17 00:00:00 2001 From: bdistin Date: Mon, 15 Jan 2018 18:20:09 -0600 Subject: [PATCH] Add parent, nsfw, bitrate, and userLimit options to GuildChannel.clone() (#2259) * Add parent, nsfw, bitrate, and userLimit options to GuildChannel.clone() * fix lint --- src/structures/GuildChannel.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 11cc571e9..a7c5b5244 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -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} */ - 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); }