/// <summary> /// get followers of the connected channels /// </summary> /// <returns>enumeration of followers</returns> IEnumerable <UserInformation> GetFollowers_Api() { if (channeldata == null) { Logger.Warning(this, "No channel connected to get followers"); yield break; } string pagination = null; do { GetFollowerResponse response = null; try { response = twitchapi.GetFollowers(userdata.ID, 100, pagination); } catch (Exception e) { Logger.Warning(this, $"Unable to get followers for '{userdata.Login}'", e.Message); } if (response != null) { User[] users = context.GetModule <UserModule>().GetUsersByKey(TwitchConstants.ServiceKey, response.Data.Select(u => u.FromID).ToArray()); string[] unknownids = response.Data.Where(u => users.All(us => us.Key != u.FromID)).Select(u => u.FromID).ToArray(); try { users = users.Concat(UpdateUserData(unknownids)).ToArray(); } catch (Exception e) { Logger.Error(this, "Unable to update unknown userdata", e); } foreach (UserInformation user in users.Select(f => new UserInformation { Service = TwitchConstants.ServiceKey, Username = f.Name, Avatar = f.Avatar })) { yield return(user); } } if (response?.Data?.Length < 100) { break; } pagination = response?.Pagination?.Cursor; }while(true); }