From 4f8f2087c16ec8b6d9b785edbaba1c073ad15fc3 Mon Sep 17 00:00:00 2001 From: Isabella Date: Thu, 21 Dec 2017 02:31:17 -0600 Subject: [PATCH] docs/fix(setParent): docs update and nullable channel param (#2160) * fix(setParent): no longer in GuildChannel * refactored * little bit less ugly * space/appel suggestion * docs fix * shhhhhhhh * fun docs trip * prototype thing * mark nullable --- src/structures/CategoryChannel.js | 13 +++++++++++++ src/structures/GuildChannel.js | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/structures/CategoryChannel.js b/src/structures/CategoryChannel.js index d7121a32b..b9d3ceff2 100644 --- a/src/structures/CategoryChannel.js +++ b/src/structures/CategoryChannel.js @@ -13,6 +13,19 @@ class CategoryChannel extends GuildChannel { get children() { return this.guild.channels.filter(c => c.parentID === this.id); } + + /** + * Sets the category parent of this channel. + * It is not currently possible to set the parent of a CategoryChannel. + * @method setParent + * @memberof CategoryChannel + * @instance + * @param {?GuildChannel|Snowflake} channel Parent channel + * @param {Object} [options={}] Options to pass + * @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are + * @param {string} [options.reason] Reason for modifying the parent of this channel + * @returns {Promise} + */ } module.exports = CategoryChannel; diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 316bdbefe..0862f1455 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -323,14 +323,15 @@ class GuildChannel extends Channel { /** * Sets the category parent of this channel. - * @param {GuildChannel|Snowflake} channel Parent channel - * @param {boolean} [options.lockPermissions] Lock the permissions to what the parent's permissions are + * @param {?GuildChannel|Snowflake} channel Parent channel + * @param {Object} [options={}] Options to pass + * @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are * @param {string} [options.reason] Reason for modifying the parent of this channel * @returns {Promise} */ setParent(channel, { lockPermissions = true, reason } = {}) { return this.edit({ - parentID: channel.id ? channel.id : channel, + parentID: channel !== null ? channel.id ? channel.id : channel : null, lockPermissions, }, reason); }