Add Cookies to the highscore
This commit is contained in:
parent
1884fc5559
commit
d3038b90a8
3 changed files with 15 additions and 2 deletions
|
@ -46,7 +46,7 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
}
|
||||
catch
|
||||
{
|
||||
await ReplyAsync("Valid types are '`messages`' '`karma`', '`rolls`'");
|
||||
await ReplyAsync("Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ namespace Geekbot.net.Lib.Highscores
|
|||
case HighscoreTypes.rolls:
|
||||
list = GetRollsList(guildId, amount);
|
||||
break;
|
||||
case HighscoreTypes.cookies:
|
||||
list = GetCookiesList(guildId, amount);
|
||||
break;
|
||||
default:
|
||||
list = new Dictionary<ulong, int>();
|
||||
break;
|
||||
|
@ -102,5 +105,14 @@ namespace Geekbot.net.Lib.Highscores
|
|||
.Take(amount)
|
||||
.ToDictionary(key => key.UserId.AsUlong(), key => key.Rolls);
|
||||
}
|
||||
|
||||
public Dictionary<ulong, int> GetCookiesList(ulong guildId, int amount)
|
||||
{
|
||||
return _database.Cookies
|
||||
.Where(k => k.GuildId.Equals(guildId.AsLong()))
|
||||
.OrderByDescending(o => o.Cookies)
|
||||
.Take(amount)
|
||||
.ToDictionary(key => key.UserId.AsUlong(), key => key.Cookies);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
messages,
|
||||
karma,
|
||||
rolls
|
||||
rolls,
|
||||
cookies
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue