Beispiel #1
0
        public async Task UpdateAll()
        {
            // Ignore everything until the API connection to all guilds is ready.
            if (guilds == null || !roleInitComplete)
            {
                return;
            }

            System.Console.WriteLine("Updating player ranks (period:" + Settings.updatePeriod.ToString() + ").");

            // We create a copy of the discord -- uplay mapping so that we can iterate without holding the lock.
            Dictionary <ulong, string> duplicateDiscordUplay = await _data.DuplicateUplayMapping();

            int count = 0;

            foreach (KeyValuePair <ulong, string> entry in duplicateDiscordUplay)
            {
                await RefreshRank(entry.Key, entry.Value);

                count++;
                // TODO: Possibly erase from the DB if the user IS null.
            }
            System.Console.WriteLine("Checked or updated " + count + " users.");
        }