From 5ccb4b730fc5965bba5c67b0f06bf68bcf70ee84 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Thu, 13 Jan 2022 03:37:17 +0700 Subject: [PATCH] Fix no players in leaderboards command --- Commands.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Commands.fs b/Commands.fs index e57da54..2fad0bd 100644 --- a/Commands.fs +++ b/Commands.fs @@ -152,11 +152,12 @@ let leaderboard (ctx : InteractionContext) = async { let builder = DiscordInteractionResponseBuilder() builder.IsEphemeral <- true - builder.Content <- + let content = players |> List.sortByDescending (fun p -> p.Bank) |> List.mapi (fun i p -> $"{i + 1}. {p.Bank} {p.Name}") |> String.concat "\n" + builder.Content <- if not <| String.IsNullOrEmpty content then content else "There are no active hackers" do! ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask } |> Async.StartAsTask