diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 3567ea4f9..d75678b7d 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -447,35 +447,37 @@ class GuildChannel extends Channel { return invites; } + /* eslint-disable max-len */ /** * Clones this channel. * @param {Object} [options] The options - * @param {string} [options.name=this.name] Optional name for the new channel, otherwise it has the name - * of this 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 {string} [options.name=this.name] Name of the new channel + * @param {OverwriteResolvable[]|Collection} [options.permissionOverwrites=this.permissionOverwrites] + * Permission overwrites of the new channel + * @param {string} [options.type=this.type] Type of the new channel + * @param {string} [options.topic=this.topic] Topic of the new channel (only text) * @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 {number} [options.rateLimitPerUser=ThisType.rateLimitPerUser] Ratelimit per user for the new channel (only text) + * @param {ChannelResolvable} [options.parent=this.parent] Parent of the new channel * @param {string} [options.reason] Reason for cloning this channel * @returns {Promise} */ + /* eslint-enable max-len */ clone(options = {}) { - if (typeof options.withPermissions === 'undefined') options.withPermissions = true; - if (typeof options.withTopic === 'undefined') options.withTopic = true; Util.mergeDefault({ name: this.name, - permissionOverwrites: options.withPermissions ? this.permissionOverwrites : [], - topic: options.withTopic ? this.topic : undefined, + permissionOverwrites: this.permissionOverwrites, + topic: this.topic, + type: this.type, nsfw: this.nsfw, parent: this.parent, bitrate: this.bitrate, userLimit: this.userLimit, + rateLimitPerUser: this.rateLimitPerUser, reason: null, }, options); - options.type = this.type; return this.guild.channels.create(options.name, options); } diff --git a/typings/index.d.ts b/typings/index.d.ts index 30ccf253b..faed57ef2 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -523,7 +523,7 @@ declare module 'discord.js' { public readonly permissionsLocked: boolean; public readonly position: number; public rawPosition: number; - public clone(options?: GuildChannelCloneOptions): Promise; + public clone(options?: GuildCreateChannelOptions): Promise; public createInvite(options?: InviteOptions): Promise; public createOverwrite(userOrRole: RoleResolvable | UserResolvable, options: PermissionOverwriteOption, reason?: string): Promise; public edit(data: ChannelData, reason?: string): Promise; @@ -1772,17 +1772,6 @@ declare module 'discord.js' { MESSAGE?: string; }; - type GuildChannelCloneOptions = { - bitrate?: number; - name?: string; - nsfw?: boolean; - parent?: ChannelResolvable; - reason?: string; - userLimit?: number; - withPermissions?: boolean; - withTopic?: boolean; - }; - type GuildChannelResolvable = Snowflake | GuildChannel; type GuildCreateChannelOptions = {