Beispiel #1
0
        private void Restore()
        {
            List <long> UserIds = new List <long>();

            UserIds.AddRange(Online);
            UserIds.AddRange(Offline);

            if (UserIds.Count == 0)
            {
                foreach (var Settings in Global.GuildSettings.Settings)
                {
                    foreach (long Id in Settings.Value.TwitchTrack.UserIds)
                    {
                        if (!UserIds.Contains(Id))
                        {
                            UserIds.Add(Id);
                        }
                    }
                }
            }

            Tracking.AddRange(UserIds);

            List <UserResponse> Users = new List <UserResponse>();

            for (int i = 0; i < UserIds.Count; i += 100)
            {
                GetUsersResponse resp = api.Helix.Users.GetUsersAsync(UserIds.Skip(i).Take(100).Select(t => t.ToString()).ToList()).Result;
                Users.AddRange(resp.Users.Select(t => new UserResponse(t)));
            }

            for (int i = 0; i < Users.Count; i++)
            {
                UserResponse User = Users[i];
                UserDatabase.Add(User.Id, User);
            }
        }