Merge branch 'master' into voice-rewrite

This commit is contained in:
Amish Shah
2018-01-16 17:24:07 +00:00
8 changed files with 76 additions and 49 deletions

View File

@@ -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);
}