public static void InvokeOnNewUserFound(List <string> UserList) { var userList = new List <TwitchLib.Models.API.v5.Users.User>(); foreach (var user in UserList) { if (!Database.Users.IsUserInDatabase(user)) { var twitchUser = TwitchAPI.Users.v5.GetUserByName(user).Result; //TwitchApi.Users.GetUser(user); if (twitchUser != null && twitchUser.Total > 0) { foreach (var userMatch in twitchUser.Matches) { if (String.Compare(user, userMatch.Name, true) != 0) { continue; } userList.Add(userMatch); } } } } if (userList.Any()) { OnNewUserFound?.Invoke(null, new OnNewUserFoundArgs { Users = userList }); } }
/// <summary> /// Invoke the Eventhandler /// </summary> /// <param name="userList"></param> private static void InvokeUserJoined(List <TwitchLib.Models.API.v5.Users.User> userList) { OnNewUserFound?.Invoke( null, new OnNewUserFoundArgs { Users = userList }); }