refactor(Guild): remove deprecated setXPositions methods (#6897)

This commit is contained in:
Almeida
2022-01-07 22:12:31 +00:00
committed by GitHub
parent b246fc4101
commit 43e5e3c339
4 changed files with 23 additions and 76 deletions

View File

@@ -204,6 +204,22 @@ class GuildChannelManager extends CachedManager {
return channels;
}
/**
* 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 {GuildChannel|Snowflake} channel Channel to update
* @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.
* <info>Only one channel's parent can be changed at a time</info>

View File

@@ -236,6 +236,13 @@ class RoleManager extends CachedManager {
this.client.actions.GuildRoleDelete.handle({ guild_id: this.guild.id, role_id: id });
}
/*
* The data needed for updating a guild role's position
* @typedef {Object} GuildRolePosition
* @property {RoleResolvable} role The role's id
* @property {number} position The position to update
*/
/**
* Batch-updates the guild's role positions
* @param {GuildRolePosition[]} rolePositions Role positions to update

View File

@@ -36,8 +36,6 @@ const DataResolver = require('../util/DataResolver');
const SystemChannelFlags = require('../util/SystemChannelFlags');
const Util = require('../util/Util');
let deprecationEmittedForSetChannelPositions = false;
let deprecationEmittedForSetRolePositions = false;
let deprecationEmittedForDeleted = false;
/**
@@ -1219,76 +1217,6 @@ class Guild extends AnonymousGuild {
return this.edit({ premiumProgressBarEnabled: enabled }, 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 {GuildChannel|Snowflake} channel Channel to update
* @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.
* <info>Only one channel's parent can be changed at a time</info>
* @param {ChannelPosition[]} channelPositions Channel positions to update
* @returns {Promise<Guild>}
* @deprecated Use {@link GuildChannelManager#setPositions} instead
* @example
* guild.setChannelPositions([{ channel: channelId, position: newChannelIndex }])
* .then(guild => console.log(`Updated channel positions for ${guild}`))
* .catch(console.error);
*/
setChannelPositions(channelPositions) {
if (!deprecationEmittedForSetChannelPositions) {
process.emitWarning(
'The Guild#setChannelPositions method is deprecated. Use GuildChannelManager#setPositions instead.',
'DeprecationWarning',
);
deprecationEmittedForSetChannelPositions = true;
}
return this.channels.setPositions(channelPositions);
}
/**
* The data needed for updating a guild role's position
* @typedef {Object} GuildRolePosition
* @property {RoleResolvable} role The role's id
* @property {number} position The position to update
*/
/**
* Batch-updates the guild's role positions
* @param {GuildRolePosition[]} rolePositions Role positions to update
* @returns {Promise<Guild>}
* @deprecated Use {@link RoleManager#setPositions} instead
* @example
* guild.setRolePositions([{ role: roleId, position: updatedRoleIndex }])
* .then(guild => console.log(`Role positions updated for ${guild}`))
* .catch(console.error);
*/
setRolePositions(rolePositions) {
if (!deprecationEmittedForSetRolePositions) {
process.emitWarning(
'The Guild#setRolePositions method is deprecated. Use RoleManager#setPositions instead.',
'DeprecationWarning',
);
deprecationEmittedForSetRolePositions = true;
}
return this.roles.setPositions(rolePositions);
}
/**
* Edits the guild's widget settings.
* @param {GuildWidgetSettingsData} settings The widget settings for the guild

View File

@@ -946,8 +946,6 @@ export class Guild extends AnonymousGuild {
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
/** @deprecated Use {@link GuildChannelManager.setPositions} instead */
public setChannelPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
public setDefaultMessageNotifications(
defaultMessageNotifications: DefaultMessageNotificationLevel | number,
reason?: string,
@@ -965,8 +963,6 @@ export class Guild extends AnonymousGuild {
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
/** @deprecated Use {@link RoleManager.setPositions} instead */
public setRolePositions(rolePositions: readonly RolePosition[]): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;