Add support for !rank quote
This commit is contained in:
parent
17f62d7607
commit
8bdf2e9681
3 changed files with 16 additions and 3 deletions
|
@ -147,8 +147,8 @@ namespace Geekbot.Bot.Commands.Utils.Quote
|
|||
.Where(row => row.GuildId == Context.Guild.Id.AsLong())
|
||||
.GroupBy(row => row.UserId)
|
||||
.Select(row => new { userId = row.Key, amount = row.Count()})
|
||||
.OrderBy(row => row.amount)
|
||||
.Last();
|
||||
.OrderByDescending(row => row.amount)
|
||||
.First();
|
||||
var mostQuotedPersonUser = Context.Client.GetUserAsync(mostQuotedPerson.userId.AsUlong()).Result ?? new UserPolyfillDto {Username = "Unknown User"};
|
||||
|
||||
var quotesByYear = _database.Quotes
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace Geekbot.Core.Highscores
|
|||
HighscoreTypes.rolls => GetRollsList(guildId, amount),
|
||||
HighscoreTypes.cookies => GetCookiesList(guildId, amount),
|
||||
HighscoreTypes.seasons => GetMessageSeasonList(guildId, amount, season),
|
||||
HighscoreTypes.quotes => GetQuotesList(guildId, amount),
|
||||
_ => new Dictionary<ulong, int>()
|
||||
};
|
||||
|
||||
|
@ -115,5 +116,16 @@ namespace Geekbot.Core.Highscores
|
|||
.Take(amount)
|
||||
.ToDictionary(key => key.UserId.AsUlong(), key => key.Cookies);
|
||||
}
|
||||
|
||||
private Dictionary<ulong, int> GetQuotesList(ulong guildId, int amount)
|
||||
{
|
||||
return _database.Quotes
|
||||
.Where(row => row.GuildId == guildId.AsLong())
|
||||
.GroupBy(row => row.UserId)
|
||||
.Select(row => new { userId = row.Key, amount = row.Count()})
|
||||
.OrderByDescending(row => row.amount)
|
||||
.Take(amount)
|
||||
.ToDictionary(key => key.userId.AsUlong(), key => key.amount);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
karma,
|
||||
rolls,
|
||||
cookies,
|
||||
seasons
|
||||
seasons,
|
||||
quotes
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue