mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
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
This commit is contained in:
@@ -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.
|
||||
* <warn>It is not currently possible to set the parent of a CategoryChannel.</warn>
|
||||
* @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<GuildChannel>}
|
||||
*/
|
||||
}
|
||||
|
||||
module.exports = CategoryChannel;
|
||||
|
||||
@@ -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<GuildChannel>}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user