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
|
catch
|
||||||
{
|
{
|
||||||
await ReplyAsync("Valid types are '`messages`' '`karma`', '`rolls`'");
|
await ReplyAsync("Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ namespace Geekbot.net.Lib.Highscores
|
||||||
case HighscoreTypes.rolls:
|
case HighscoreTypes.rolls:
|
||||||
list = GetRollsList(guildId, amount);
|
list = GetRollsList(guildId, amount);
|
||||||
break;
|
break;
|
||||||
|
case HighscoreTypes.cookies:
|
||||||
|
list = GetCookiesList(guildId, amount);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
list = new Dictionary<ulong, int>();
|
list = new Dictionary<ulong, int>();
|
||||||
break;
|
break;
|
||||||
|
@ -102,5 +105,14 @@ namespace Geekbot.net.Lib.Highscores
|
||||||
.Take(amount)
|
.Take(amount)
|
||||||
.ToDictionary(key => key.UserId.AsUlong(), key => key.Rolls);
|
.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,
|
messages,
|
||||||
karma,
|
karma,
|
||||||
rolls
|
rolls,
|
||||||
|
cookies
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue