mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +01:00
fix(Util): fix sorting for GuildChannels (#7002)
This commit is contained in:
@@ -483,11 +483,11 @@ class Util extends null {
|
|||||||
* @returns {Collection}
|
* @returns {Collection}
|
||||||
*/
|
*/
|
||||||
static discordSort(collection) {
|
static discordSort(collection) {
|
||||||
|
const isGuildChannel = collection.first() instanceof GuildChannel;
|
||||||
return collection.sorted(
|
return collection.sorted(
|
||||||
(a, b) =>
|
isGuildChannel
|
||||||
a.rawPosition - b.rawPosition ||
|
? (a, b) => a.rawPosition - b.rawPosition || Number(BigInt(a.id) - BigInt(b.id))
|
||||||
parseInt(b.id.slice(0, -10)) - parseInt(a.id.slice(0, -10)) ||
|
: (a, b) => a.rawPosition - b.rawPosition || Number(BigInt(b.id) - BigInt(a.id)),
|
||||||
parseInt(b.id.slice(10)) - parseInt(a.id.slice(10)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,3 +616,6 @@ class Util extends null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Util;
|
module.exports = Util;
|
||||||
|
|
||||||
|
// Fixes Circular
|
||||||
|
const GuildChannel = require('../structures/GuildChannel');
|
||||||
|
|||||||
Reference in New Issue
Block a user