mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
refactor(Guild): remove deprecated setXPositions methods (#6897)
This commit is contained in:
@@ -204,6 +204,22 @@ class GuildChannelManager extends CachedManager {
|
|||||||
return channels;
|
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.
|
* Batch-updates the guild's channels' positions.
|
||||||
* <info>Only one channel's parent can be changed at a time</info>
|
* <info>Only one channel's parent can be changed at a time</info>
|
||||||
|
|||||||
@@ -236,6 +236,13 @@ class RoleManager extends CachedManager {
|
|||||||
this.client.actions.GuildRoleDelete.handle({ guild_id: this.guild.id, role_id: id });
|
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
|
* Batch-updates the guild's role positions
|
||||||
* @param {GuildRolePosition[]} rolePositions Role positions to update
|
* @param {GuildRolePosition[]} rolePositions Role positions to update
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ const DataResolver = require('../util/DataResolver');
|
|||||||
const SystemChannelFlags = require('../util/SystemChannelFlags');
|
const SystemChannelFlags = require('../util/SystemChannelFlags');
|
||||||
const Util = require('../util/Util');
|
const Util = require('../util/Util');
|
||||||
|
|
||||||
let deprecationEmittedForSetChannelPositions = false;
|
|
||||||
let deprecationEmittedForSetRolePositions = false;
|
|
||||||
let deprecationEmittedForDeleted = false;
|
let deprecationEmittedForDeleted = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1219,76 +1217,6 @@ class Guild extends AnonymousGuild {
|
|||||||
return this.edit({ premiumProgressBarEnabled: enabled }, reason);
|
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.
|
* Edits the guild's widget settings.
|
||||||
* @param {GuildWidgetSettingsData} settings The widget settings for the guild
|
* @param {GuildWidgetSettingsData} settings The widget settings for the guild
|
||||||
|
|||||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -946,8 +946,6 @@ export class Guild extends AnonymousGuild {
|
|||||||
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
|
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
||||||
public setBanner(banner: BufferResolvable | Base64Resolvable | null, 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(
|
public setDefaultMessageNotifications(
|
||||||
defaultMessageNotifications: DefaultMessageNotificationLevel | number,
|
defaultMessageNotifications: DefaultMessageNotificationLevel | number,
|
||||||
reason?: string,
|
reason?: string,
|
||||||
@@ -965,8 +963,6 @@ export class Guild extends AnonymousGuild {
|
|||||||
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
|
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
|
||||||
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
|
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
|
||||||
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, 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 setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
||||||
|
|||||||
Reference in New Issue
Block a user