public async Task GetServiceLeaderboardImplementationAsync(string category, Tier?tier, int pageNumber) { using (Context.Channel.EnterTypingState()) { CompleteScoreboardSummary teamScore = await ScoreRetrievalService.GetScoreboardAsync(new ScoreboardFilterInfo(Division.AllService, tier)).ConfigureAwait(false); if (teamScore == null) { throw new Exception("Error obtaining scoreboard."); } // validate category string realCategory = teamScore.TeamList.Where(t => CategoryEquals(t, category)).Select(t => t.Category).Distinct().SingleIfOne(); if (realCategory == null) { throw new ArgumentException("The given category was not found - it was either ambiguous or invalid.", nameof(category)); } await ReplyAsync(ScoreEmbedBuilder.CreateTopLeaderboardEmbed(teamScore, pageNumber: pageNumber, customFilter: new ScoreboardMessageBuilderService.CustomFiltrationInfo() { Predicate = t => t.Category == realCategory, FilterDescription = realCategory }, timeZone: await Preferences.GetTimeZoneAsync(Context.Guild, Context.User).ConfigureAwait(false))).ConfigureAwait(false); } }
public async Task GetLeaderboardAsync(Division division, Tier tier, int pageNumber = 1) { using (Context.Channel.EnterTypingState()) { CompleteScoreboardSummary teamScore = await ScoreRetrievalService.GetScoreboardAsync(new ScoreboardFilterInfo(division, tier)).ConfigureAwait(false); if (teamScore == null) { throw new Exception("Error obtaining scoreboard."); } await ReplyAsync(ScoreEmbedBuilder.CreateTopLeaderboardEmbed(teamScore, pageNumber: pageNumber, timeZone: await Preferences.GetTimeZoneAsync(Context.Guild, Context.User).ConfigureAwait(false))).ConfigureAwait(false); } }
public async Task GetLocationLeaderboardImplementationAsync(string location, ScoreboardFilterInfo filterInfo, int pageNumber) { using (Context.Channel.EnterTypingState()) { CompleteScoreboardSummary teamScore = await ScoreRetrievalService.GetScoreboardAsync(filterInfo).ConfigureAwait(false); if (teamScore == null) { throw new Exception("Error obtaining scoreboard."); } await ReplyAsync(ScoreEmbedBuilder.CreateTopLeaderboardEmbed(teamScore, pageNumber: pageNumber, customFilter: new ScoreboardMessageBuilderService.CustomFiltrationInfo() { Predicate = t => t.Location == location, FilterDescription = location // TODO full name of state? }, timeZone: await Preferences.GetTimeZoneAsync(Context.Guild, Context.User).ConfigureAwait(false))).ConfigureAwait(false); } }