From ad20ff335f0af760dcb2b3cf71aa49e59fa9eee7 Mon Sep 17 00:00:00 2001 From: Zeus2459 <29608839+Zeus2459@users.noreply.github.com> Date: Thu, 20 Feb 2020 14:58:30 -0500 Subject: [PATCH] add leaderboard command bottom text --- Kehyeedra3/Commands.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Kehyeedra3/Commands.cs b/Kehyeedra3/Commands.cs index 661e0b9..77254b4 100644 --- a/Kehyeedra3/Commands.cs +++ b/Kehyeedra3/Commands.cs @@ -664,6 +664,31 @@ namespace Kehyeedra3 } } } + [Command("leaderboard")] + public async Task Leaderboard() + { + User[] users; + User bank; + User skuld; + + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + { + users = Database.Users.OrderByDescending(user => user.Money); + bank = Database.Users.FirstOrDefault(x => x.Id == 0); + skuld = Database.Users.FirstOrDefault(x => x.Id == 1); + } + + String leaderboardMessage = "top 10 gays (#1 is extra cool):"; + for (int i = 0; i < 10; i++) + { + String percent = $"{ users[i].Money / 10000d }"; + String percentCirculating = $"{(users[i].Money * 100) / (1000000 - bank.Money - skuld.Money)}"; + leaderboardMessage += "\n" + users[i].Mention + ": " + percent + " % - " + percentCirculating + "%C"; + } + + await Context.Channel.SendMessageAsync(leaderboardMessage); + + } [Command("give")] public async Task GiveShekel(IGuildUser person, int amount) {