Пример #1
0
        /// <summary>
        /// Returns an <see cref="Embed"/> that contains the message for the leaderboard display.
        /// </summary>
        private static async Task <Embed> BuildForNextPlaces(EventPointTable table, IGuild guild, int startIndex, int pagesize)
        {
            IEnumerable <KeyValuePair <ulong, int> > places = table.GetLeaderboardPlaces(startIndex, pagesize);

            EmbedBuilder eb = new EmbedBuilder()
                              .WithColor(new Color(162, 219, 160))
                              .WithTitle("Event Point 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 username = user?.GetDisplayName() ?? "<invalid-user>"; // if the guild doesn't contain the user, return "<invalid-user>"

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

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

                eb.AddField(title, content);
            }

            return(eb);
        }
Пример #2
0
        /// <summary>
        /// Initializes the data files from the disk
        /// </summary>
        public void InitializeDataFiles()
        {
            // Load the lookup files
            EventPoints    = new EventPointTable();
            Settings       = new SettingsTable();
            Statistics     = new StatisticsTable();
            CustomCommands = new CustomCommandsTable();
            Rules          = new RuleTable();
            Mutes          = new MuteTable();
            Bans           = new BanTable();

            UnityDocs = new UnityDocs("manualReference.json", "scriptReference.json");
            Cooldowns = CooldownData.FromPath("cooldowns.json");
        }
Пример #3
0
 public LeaderboardNavigator(EventPointTable table, SettingsTable settings)
 {
     _table    = table;
     _settings = settings;
 }
Пример #4
0
 public EventPointCommand(SettingsTable settings, EventPointTable pointTable, LeaderboardNavigator navigator)
 {
     _settings   = settings;
     _pointTable = pointTable;
     _navigator  = navigator;
 }