mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
refactor(RoleManager): Remove comparePositions() (#7201)
This commit is contained in:
@@ -7,8 +7,6 @@ const Permissions = require('../util/Permissions');
|
|||||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||||
const Util = require('../util/Util');
|
const Util = require('../util/Util');
|
||||||
|
|
||||||
let deprecationEmittedForComparePositions = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {WeakSet<Role>}
|
* @type {WeakSet<Role>}
|
||||||
* @private
|
* @private
|
||||||
@@ -480,27 +478,6 @@ class Role extends Base {
|
|||||||
permissions: this.permissions.toJSON(),
|
permissions: this.permissions.toJSON(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares the positions of two roles.
|
|
||||||
* @param {Role} role1 First role to compare
|
|
||||||
* @param {Role} role2 Second role to compare
|
|
||||||
* @returns {number} Negative number if the first role's position is lower (second role's is higher),
|
|
||||||
* positive number if the first's is higher (second's is lower), 0 if equal
|
|
||||||
* @deprecated Use {@link RoleManager#comparePositions} instead.
|
|
||||||
*/
|
|
||||||
static comparePositions(role1, role2) {
|
|
||||||
if (!deprecationEmittedForComparePositions) {
|
|
||||||
process.emitWarning(
|
|
||||||
'The Role.comparePositions method is deprecated. Use RoleManager#comparePositions instead.',
|
|
||||||
'DeprecationWarning',
|
|
||||||
);
|
|
||||||
|
|
||||||
deprecationEmittedForComparePositions = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return role1.guild.roles.comparePositions(role1, role2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Role = Role;
|
exports.Role = Role;
|
||||||
|
|||||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -1952,9 +1952,6 @@ export class Role extends Base {
|
|||||||
public setUnicodeEmoji(unicodeEmoji: string | null, reason?: string): Promise<Role>;
|
public setUnicodeEmoji(unicodeEmoji: string | null, reason?: string): Promise<Role>;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
public toString(): RoleMention;
|
public toString(): RoleMention;
|
||||||
|
|
||||||
/** @deprecated Use {@link RoleManager.comparePositions} instead. */
|
|
||||||
public static comparePositions(role1: Role, role2: Role): number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectMenuInteraction<Cached extends CacheType = CacheType> extends MessageComponentInteraction<Cached> {
|
export class SelectMenuInteraction<Cached extends CacheType = CacheType> extends MessageComponentInteraction<Cached> {
|
||||||
|
|||||||
Reference in New Issue
Block a user