add leaderboard command

bottom text
pull/2/head
Zeus2459 5 years ago committed by GitHub
parent 6cff0b753b
commit ad20ff335f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      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")] [Command("give")]
public async Task GiveShekel(IGuildUser person, int amount) public async Task GiveShekel(IGuildUser person, int amount)
{ {

Loading…
Cancel
Save