diff --git a/src/structures/Guild.js b/src/structures/Guild.js index fcdde7746c76..44fabd462d51 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1272,15 +1272,25 @@ class Guild extends Base { return this.edit({ preferredLocale }, reason); } + /** + * Data that can be resolved to give a Category Channel object. This can be: + * * A CategoryChannel object + * * A Snowflake + * @typedef {CategoryChannel|Snowflake} CategoryChannelResolvable + */ + /** * The data needed for updating a channel's position. * @typedef {Object} ChannelPosition * @property {ChannelResolvable} channel Channel to update - * @property {number} position New position for the channel + * @property {number} [position] New position for the channel + * @property {CategoryChannelResolvable} [parent] Parent channel for this channel + * @property {boolean} [lockPermissions] If the overwrites should be locked to the parents overwrites */ /** * Batch-updates the guild's channels' positions. + * Only one channel's parent can be changed at a time * @param {ChannelPosition[]} channelPositions Channel positions to update * @returns {Promise} * @example @@ -1292,6 +1302,8 @@ class Guild extends Base { const updatedChannels = channelPositions.map(r => ({ id: this.client.channels.resolveID(r.channel), position: r.position, + lock_permissions: r.lockPermissions, + parent_id: this.channels.resolveID(r.parent), })); return this.client.api diff --git a/typings/index.d.ts b/typings/index.d.ts index 3b6ab82a70e6..4bb26950381d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -220,6 +220,8 @@ declare module 'discord.js' { public type: 'category'; } + type CategoryChannelResolvable = Snowflake | CategoryChannel; + export class Channel extends Base { constructor(client: Client, data?: object); public readonly createdAt: Date; @@ -2358,7 +2360,9 @@ declare module 'discord.js' { interface ChannelPosition { channel: ChannelResolvable; - position: number; + lockPermissions?: boolean; + parent?: CategoryChannelResolvable; + position?: number; } type ChannelResolvable = Channel | Snowflake;