Exemplo n.º 1
0
        private static async Task <EmbedBuilder> BuildForNextPlaces(KarmaTable table, IGuild guild, int startIndex, int pagesize)
        {
            IEnumerable <KeyValuePair <ulong, int> > places = table.GetLeaderboardPlaces(startIndex, pagesize);

            EmbedBuilder eb = new EmbedBuilder()
                              .WithColor(new Color(0, 255, 255))
                              .WithTitle("Karma Leaderboard:");

            int count = places.Count();

            for (int i = 0; i < count; i++)
            {
                KeyValuePair <ulong, int> place = places.ElementAt(i);

                IGuildUser user = await guild.GetUserAsync(place.Key);

                string pointsDisplay = $"{ place.Value } point{ (place.Value != 1 ? "s" : "") }";

                string title   = GetPlaceStringRepresentation(startIndex + i);
                string content = $"{ UserHelper.GetDisplayName(user) } with { pointsDisplay }.";

                eb.AddField(title, content);
            }

            return(eb);
        }
Exemplo n.º 2
0
 public KarmaCommand(KarmaTable karmaTable, SettingsTable settings)
 {
     _karmaTable = karmaTable;
     _settings   = settings;
 }
Exemplo n.º 3
0
 public LeaderboardNavigator(KarmaTable table, SettingsTable settings)
 {
     _table    = table;
     _settings = settings;
 }
Exemplo n.º 4
0
 public LeaderboardCommand(KarmaTable karmaTable, SettingsTable settings, LeaderboardNavigator navigator)
 {
     _karmaTable = karmaTable;
     _settings   = settings;
     _navigator  = navigator;
 }
Exemplo n.º 5
0
 public PointsCommand(KarmaTable karmaTable, SettingsTable settingsTable)
 {
     _karmaTable = karmaTable;
     _settings   = settingsTable;
 }