From 5b46ae59bd204a2b3e6f77120dbdfdb9cf6c6810 Mon Sep 17 00:00:00 2001 From: Frangu Vlad Date: Sat, 9 Sep 2017 21:18:41 +0300 Subject: [PATCH] Fix some documentation about the category channels (#1917) * Document CategoryChannel * More fixes * Sorry Crawl * createChannel can return CategoryChannel * Did senks requests * I can't grammar * Other snek request --- src/structures/CategoryChannel.js | 9 +++++++++ src/structures/Guild.js | 2 +- src/structures/GuildChannel.js | 7 +++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/structures/CategoryChannel.js b/src/structures/CategoryChannel.js index 89b8b3165..dd53e1d79 100644 --- a/src/structures/CategoryChannel.js +++ b/src/structures/CategoryChannel.js @@ -1,6 +1,15 @@ const GuildChannel = require('./GuildChannel'); +/** + * Represents a guild category channel on Discord. + * @extends {GuildChannel} + */ class CategoryChannel extends GuildChannel { + /** + * The channels that are part of this category + * @type {?Collection} + * @readonly + */ get children() { return this.guild.channels.filter(c => c.parentID === this.id); } diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 4af91a5c7..f25213dd4 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -895,7 +895,7 @@ class Guild extends Base { * @param {Object} [options] Options * @param {Array} [options.overwrites] Permission overwrites * @param {string} [options.reason] Reason for creating this channel - * @returns {Promise} + * @returns {Promise} * @example * // Create a new text channel * guild.createChannel('new-general', 'text') diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index f45a5de48..346100283 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -9,7 +9,7 @@ const Constants = require('../util/Constants'); const { TypeError } = require('../errors'); /** - * Represents a guild channel (i.e. text channels and voice channels). + * Represents a guild channel (e.g. text channels and voice channels). * @extends {Channel} */ class GuildChannel extends Channel { @@ -58,7 +58,8 @@ class GuildChannel extends Channel { /** * The category parent of this channel - * @type {?GuildChannel} + * @type {?CategoryChannel} + * @readonly */ get parent() { return this.guild.channels.get(this.parentID); @@ -232,6 +233,8 @@ class GuildChannel extends Channel { * @property {string} [topic] The topic of the text channel * @property {number} [bitrate] The bitrate of the voice channel * @property {number} [userLimit] The user limit of the voice channel + * @property {Snowflake} [parentID] The parent ID of the channel + * @property {boolean} [lockPermissions] Lock the permissions of the channel to what the parent's permissions are */ /**