From 097b7284e6b910352313ff0c6d581792c694e01c Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 26 Jul 2024 18:29:57 +0100 Subject: [PATCH] Fix list not being sorted (#320) - Fix list on `/allbalance` command not being sorted by currency #260 Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/320 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/commands/allbalance.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/allbalance.ts b/src/commands/allbalance.ts index 7db050a..0874e54 100644 --- a/src/commands/allbalance.ts +++ b/src/commands/allbalance.ts @@ -16,7 +16,8 @@ export default class AllBalance extends Command { public override async execute(interaction: CommandInteraction) { const users = await User.FetchAll(User); - const filteredUsers = users.filter(x => x.Currency > 0); + const filteredUsers = users.filter(x => x.Currency > 0) + .sort((a, b) => b.Currency - a.Currency); const embed = new EmbedBuilder() .setColor(EmbedColours.Ok)