/// <summary> /// Fires when existing Users detected in Channel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async static void OnExistingUserJoined(object sender, OnExistingUsersDetectedArgs e) { //var userList = new List<TwitchLib.Models.API.User.User>(); var userList = new List <TwitchLib.Models.API.v5.Users.User>(); foreach (var user in e.Users) { var twitchUser = await TwitchAPI.Users.v5.GetUserByName(user); if (twitchUser != null && twitchUser.Total > 0) { foreach (var userMatch in twitchUser.Matches) { if (String.Compare(userMatch.Name, user) != 0) { continue; } userList.Add(userMatch); } } } if (userList.Any()) { InvokeUserJoined(userList); } }
private void onExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { foreach (string user in e.Users) { listBox3.Items.Add(user); } }
/// <summary> /// Fires when new Users joined and add them /// </summary> /// <param name="sender"></param> /// <param name="e"></param> internal void AddUserToDatabase(object sender, OnExistingUsersDetectedArgs e) { e.Users.ForEach(user => { var twitchUser = AivaClient.Instance.TwitchApi.Users.v5.GetUserByNameAsync(user).Result; AddUserToDatabase(twitchUser.Matches[0]); }); }
internal static ExistingUsersDetectedEvent Map(this OnExistingUsersDetectedArgs from) { return(new ExistingUsersDetectedEvent { Users = from.Users, Channel = from.Channel }); }
/// <summary> /// UNTESTED!!!!! TODO TEST THIS YOU LUMP OF SHIT /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void TwitchOnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { /*TwitchLib.Api.V5.Models.Users.Users users = await _api.V5.Users.GetUsersByNameAsync(e.Users); foreach (TwitchLib.Api.V5.Models.Users.User user in users.Matches) { string twitchID = user.Id; }*/ await Core.LOG(new LogEntry(LOGSEVERITY.INFO, "EventCatcherTwitch", $"TwitchOnExistingUsersDetected")); }
//viewer list private void Client_OnJoinedChannel(object sender, OnExistingUsersDetectedArgs e) { Application.Current.Dispatcher.Invoke((Action) delegate { foreach (var item in e.Users) { viewerBox.Items.Add(item); } }); }
/// <summary> /// Invokes the existing users detected. /// </summary> /// <param name="client">The client.</param> /// <param name="channel">The channel.</param> /// <param name="users">The users.</param> public static void InvokeExistingUsersDetected(this TwitchClient client, string channel, List <string> users) { OnExistingUsersDetectedArgs model = new OnExistingUsersDetectedArgs() { Channel = channel, Users = users }; client.RaiseEvent("OnExistingUsersDetected", model); }
private void Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { try { GetChannelProcessor(e.Channel)?.OnExistingUsersDetected(sender, e); } catch (Exception ex) { Logger.Instance.Error($"[{0}] Unchaught exception: {ex.Info()}", MethodBase.GetCurrentMethod().Name); } }
private async void Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { string channel = e.Channel; _logger.LogInformation("existing users detected in channel {channel}", channel); var activity = CreateBaseActivity(channel); activity.Type = ActivityTypes.ConversationUpdate; activity.MembersAdded = e.Users.Select(u => new ChannelAccount(id: u, name: u)).ToList(); await ProcessActivityAsync(activity); }
/// <summary> /// Fires when existing users detected in Channel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void AddViewerToList(object sender, OnExistingUsersDetectedArgs e) { foreach (var user in e.Users) { var twitchUser = await AivaClient.Instance.TwitchApi.Users.v5.GetUserByNameAsync(user).ConfigureAwait(false); if (twitchUser != null) { AddViewerToList(twitchUser.Matches[0].Name, twitchUser.Matches[0].Id); } } }
private async Task Client_OnExisingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { var date = DateTime.UtcNow; Console.WriteLine($"{date.ToString(CultureInfo.InvariantCulture)}: Existing users detected in {e.Channel}: {string.Join(", ",e.Users)}"); foreach (var user in e.Users) { var entity = new ChannelActivityEntity { PartitionKey = user, RowKey = date.ToString(Constants.DATETIME_FORMAT).Replace(":", string.Empty).Replace("-", string.Empty).Replace(".", string.Empty), Activity = StreamActivity.UserJoined.ToString(), Viewer = e.Channel }; await AddEntityToStorage(entity); } }
private async Task Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { var date = DateTime.UtcNow; _logger.LogInformation( $"{date.ToRowKeyString()}: Existing users detected in {e.Channel}: {string.Join(", ", e.Users)}"); foreach (var entity in e.Users.Select(user => new ChannelActivityEntity { PartitionKey = user, RowKey = date.ToRowKeyString(), Activity = StreamActivity.UserJoined.ToString(), Viewer = e.Channel })) { await Common.AddEntityToStorage(_tableClient, entity, _streamingTable).ConfigureAwait(false); await _zapierClient.AddChannelEvent(Constants.ZAPIER_EVENTTYPE_MESSAGE, entity).ConfigureAwait(false); } }
/// <summary> /// Passes <see cref="OnExistingUsersDetected"/> events down to subscribed plugins. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An <see cref="OnExistingUsersDetectedArgs"/> object.</param> private void TwitchClient_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) => this.OnExistingUsersDetected?.Invoke(this, e);
private async void Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { await _eventProxy.PublishAsync(new TwitchExistingUsersDetectedNotification(this, e.Channel, e.Users)) .ConfigureAwait(false); }
private void ExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { _currentViewers = e.Users.Count; }
private void _client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { }
public void Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { approximateCurrentViewerCount = e.Users.Count; }
private void Client_OnExistingUsersDetected(object sender, OnExistingUsersDetectedArgs e) { var users = e.Users; var channel = e.Channel; }