Merge pull request #2 from Zeus2459/patch-1

add leaderboard command
master
Lan 5 years ago committed by GitHub
commit d1f12723d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      Kehyeedra3/Commands.cs

@ -683,6 +683,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)
{

Loading…
Cancel
Save