private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { RegisterTwitchUser(e.Username); if (ChattingViewers.Where(x => x.UserName == e.Username && x.Disconnected == null).Count() == 0) { ChattingViewers.Add(new ViewerLive() { Connected = DateTime.Now, UserName = e.Username }); } }
private void OnUserJoined(object sender, OnUserJoinedArgs e) { try { _viewersController.OnUserJoined(sender, e); } catch (Exception exception) { MessageBox.Show("Bot on user joined ex : " + exception.Message); } }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { try { GetChannelProcessor(e.Channel)?.OnUserJoined(sender, e); } catch (Exception ex) { Logger.Instance.Error($"[{0}] Unchaught exception: {ex.Info()}", MethodBase.GetCurrentMethod().Name); } }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { /*TwitchUser tu = new TwitchUser(e.Username, DateTime.Now); * * if(!Users.Contains(tu)) * { * Users.Add(tu); * } * * Console.WriteLine($"JOIN: {e.Username}");*/ }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { if (UserList.Equals()) { UserList.Add(new User { NickName = e.Username, Score = 0 }); Userdb.Users.Update(new User { NickName = e.Username, Score = 0 }); } }
// User events private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { consoleMessage[1] = "#"; consoleMessage[3] = e.Username; consoleMessage[4] = e.Channel; consoleMessage[5] = "Joined Channel"; // TODO: Add code to start timer for user // check for new user, if new, add user to system (ralphie.users ?) // mark start time for user //string message = $"[{DateTime.Now.ToString("MM/dd - HH:mm")} | Twitch] {e.Username} has joined #{e.Channel}"; Program.SendToConsole(consoleMessage); }
protected virtual void OnUserJoined(object sender, OnUserJoinedArgs args) { if (args.Channel.Trim().ToLower() == _serverDTO.Username.Trim().ToLower()) { Task.Run(async() => { try { var usersOnline = (await _twitchNetService.GetUsersOnlineAsync(this)).ToList(); var user = usersOnline.FirstOrDefault(s => s.Username.Trim().ToLower() == args.Username.Trim().ToLower()); if (user == null) { user = await _twitchNetService.GetUserByTwitchUsernameAsync(args.Username.Trim().ToLower()); if (user == null) { user = await _twitchNetService.CreateUserAsync(new UserDTO { DisplayName = args.Username, Username = args.Username }); } usersOnline.Add(user); await _twitchNetService.CreateUsersOnlineAsync(this, usersOnline.ToArray()); } await FireConnectionServerUserEventAsync(sender, new ConnectionServerUserEventArgs { ConnectionServerEventType = ConnectionServerEventType.ConnectedToServer, ConnectionEventType = ConnectionEventType.DisconnectedFromTwitch, Server = this, User = user, }); } catch (Exception ex) { await FireErrorEventAsync(sender, new ErrorBotServerUserEventArgs { Bot = _bot, Exception = ex, Server = this, Username = args.Username }); } }); } }
private async Task Client_OnUserJoined(object sender, OnUserJoinedArgs e) { Console.WriteLine($"{DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)}: {e.Username} joined the channel ({e.Channel})"); var entity = new ChannelActivityEntity { PartitionKey = e.Channel, RowKey = DateTime.UtcNow.ToString(Constants.DATETIME_FORMAT).Replace(":", string.Empty).Replace("-", string.Empty).Replace(".", string.Empty), Activity = StreamActivity.UserJoined.ToString(), Viewer = e.Username }; await AddEntityToStorage(entity); }
private void TwitchClient_OnUserJoined(object sender, OnUserJoinedArgs e) { if (Settings.UserBlacklist.Contains(e.Username, StringComparer.OrdinalIgnoreCase)) { return; } if (string.Equals(e.Username, Settings.Username, StringComparison.OrdinalIgnoreCase)) { return; } ShowMessage($"{ReplaceNickname(e.Username)} ist da", Settings.UserJoinedNotification); }
private async Task Client_OnUserJoined(object sender, OnUserJoinedArgs e) { var date = DateTime.UtcNow; _logger.LogInformation($"{date.ToRowKeyString()}: {e.Username} joined the channel ({e.Channel})"); var entity = new ChannelActivityEntity { PartitionKey = e.Channel, RowKey = date.ToRowKeyString(), Activity = StreamActivity.UserJoined.ToString(), Viewer = e.Username }; await Common.AddEntityToStorage(_tableClient, entity, _streamingTable).ConfigureAwait(false); await _zapierClient.AddChannelEvent(Constants.ZAPIER_EVENTTYPE_MESSAGE, entity).ConfigureAwait(false); }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { Console.WriteLine($"{e.Username} joined the channel. Welcome!"); // Check userSounds to see if the user has a sound file UserSound userSound = this.UserSounds.Find(s => s.Username.ToLower() == e.Username.ToLower()); if (userSound != null) { // User was found, play the sound if (SoundCommand.Exists(userSound.Sound)) { soundProcessor.Queue(new SoundCommand(userSound.Sound)); } } }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { if (!Measurables.allViewers.Contains(e.Username)) { Measurables.allViewers.Add(e.Username); } Measurables.currentViewers.Add(e.Username); Measurables.viewerCount++; int Id = Convert.ToInt32(TwitchHelpers.GetUserId(e.Username)); var newViewer = Context.ViewerStats.Where(v => v.TwitchID == Id).FirstOrDefault(); if (newViewer == null) { NewViewerConfig newViewerConfig = new NewViewerConfig(); Context.ViewerStats.Add(newViewerConfig.initViewer(e.Username, Id.ToString())); Context.SaveChanges(); } }
/// <summary> /// Fires when User joined the Channel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async static void OnUserJoined(object sender, OnUserJoinedArgs e) { var user = await TwitchAPI.Users.v5.GetUserByName(e.Username); if (user != null && user.Total > 0) { foreach (var userMatch in user.Matches) { if (String.Compare(userMatch.Name, e.Username, true) != 0) { continue; } InvokeUserJoined(new List <TwitchLib.Models.API.v5.Users.User> { userMatch }); } } }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { Console.WriteLine($"{e.Username} joined the channel. Welcome!"); // REVIEW: See if this is a feature that we still want //// Check userSounds to see if the user has a sound file //var userSoundsJson = File.ReadAllText("userSounds.json"); //var userSounds = JsonSerializer.Deserialize<List<UserSound>>(userSoundsJson); //UserSound userSound = userSounds.Find(s => s.Username.ToLower() == e.Username.ToLower()); //if (userSound != null) //{ // // User was found, play the sound // if (SoundCommand.Exists(userSound.Sound)) // { // soundProcessor.Queue(new SoundCommand(userSound.Sound)); // } //} }
//On users joining channel public void ClientUserJoined(object sender, OnUserJoinedArgs e) { Console.WriteLine("Joined: " + e.Username.ToString()); //Send(e.Username.ToString()+" joined the channel."); Dictionary <string, Viewer> _liveViewersDump = new Dictionary <string, Viewer>(_main._liveViewers.table); foreach (KeyValuePair <string, Viewer> viewer in _liveViewersDump) { if (viewer.Key == e.Username) { if (viewer.Value.twitchAuto != null) { foreach (string att in viewer.Value.twitchAuto) { _tamanager.GetSendAutoTwitch(att); } } } } }
private void OnTwitchUserJoined(object sender, OnUserJoinedArgs e) { if (e.Username == _configuration.GetSection("twitch")["username"]) { return; } _logger.LogInformation("Processing user joined event of: {User} from Channel {Channel}", e.Username, e.Channel); foreach (var userJoinedHandler in _userJoinedHandlers) { if (userJoinedHandler.ProcessEvent(_twitchInteractor, e.Username, e.Channel)) { _logger.LogInformation("Processed user joined event of {User} from Channel {Channel}, with handler {UserJoinedHandler}", e.Username, e.Channel, userJoinedHandler.GetType().Name); return; } } _logger.LogWarning("Processing user joined event of {User} from Channel {Channel} failed, no handler was available.", e.Username, e.Channel); }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { if (e.Username.ToLower().Equals("morphyum")) { client.SendMessage(e.Channel, "My Creator is back, good time to praise him or make requests! Just ping @Morphyum"); } else if (greetings) { if (viewers.Contains(e.Username)) { client.SendMessage(e.Channel, welcomeBack.Replace("(NICK)", e.Username)); } else { client.SendMessage(e.Channel, greeting.Replace("(NICK)", e.Username)); viewers.Add(e.Username); HELPER.newViewer(e.Channel, e.Username); } } System.Threading.Thread.Sleep(3000); }
internal void OnUserJoined(object sender, OnUserJoinedArgs e) { if (!TwitchBotGlobalObjects.ChanelData.Watchers.Any(user => user.Username == e.Username)) { try { Viewer joinedUser = AssistantDb.Instance.Viewers.GetAll().FirstOrDefault(viewer => viewer.Username == e.Username); if (joinedUser == null) { var user = TwitchApiController.Api.V5.Users.GetUserByNameAsync(e.Username).Result; int viewerId = int.Parse(user.Matches[0].Id); joinedUser = new Viewer() { Id = viewerId, Username = e.Username, Rang = new Rang() { RangSets = new List <RangSet>() { new RangSet() } } }; AssistantDb.Instance.Viewers.Add(joinedUser); joinedUser = AssistantDb.Instance.Viewers.Get(joinedUser.Id); } joinedUser.LastCoinUpdate = DateTime.Now; joinedUser.LastConnectToStream = DateTime.Now; AssistantDb.Instance.SaveChanges(); TwitchBotGlobalObjects.ChanelData.Watchers.Add(joinedUser); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }
private void _client_OnUserJoined(object sender, OnUserJoinedArgs e) { if (e.Username.ToLower() == Info.BotUsername.ToLower()) { return; } var getUser = Service.Helix.Users.GetUsersAsync(null, new List <string>(new[] { e.Username }), _channelBroadcaster[e.Channel].AccessToken); var getChatters = Service.Undocumented.GetChattersAsync(e.Channel); getChatters.Wait(); TwitchLib.Api.Core.Enums.UserType userType = TwitchLib.Api.Core.Enums.UserType.Viewer; foreach (var chatter in getChatters.Result) { if (chatter.Username == e.Username) { userType = chatter.UserType; break; } } getUser.Wait(); AddUser(getUser.Result.Users[0], userType, e.Channel); }
/// <summary> /// Activates when a user joins the chat /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { string strUsername = ""; string userID = ""; User[] users = new User[1]; strUsername = e.Username; users = twitchAPI.Users.v5.GetUserByNameAsync(strUsername).Result.Matches; userID = users[0].Id.ToString(); if (CheckIfUserExists(userID) == false) // If user is not found { WriteToTextFile(@"..\..\Resources\Users.txt", $"{userID} {strUsername}"); client.SendMessage($"Everyone welcome {strUsername} to the chat!"); } if (strUsername.ToLower() != "moobot" && strUsername.ToLower() != "nightbot" && strUsername.ToLower() != "60secondgamer") { lstUsersWatching.Add(new Classes.MyUser(userID, strUsername, 0, 0)); } }
private void OnJoined(object sender, OnUserJoinedArgs e) { ConsoleHelper.WriteLine($"{e.Username} joined the chat."); }
private void TwitchClientOnOnUserJoined(object sender, OnUserJoinedArgs onUserJoinedArgs) { OnUserNoticed?.Invoke(this, onUserJoinedArgs.ToUserStatusEventArgs()); }
private void onUserJoinedChannel(object sender, OnUserJoinedArgs e) { Console.WriteLine("User joined: " + e.Username); //client.SendMessage(e.Channel, "Hey guys! I am a bot connected via TwitchLib!"); }
private void OnUserJoined(object sender, OnUserJoinedArgs e) { form.UpdateViewerList(e.Username, true); }
private void OnUserJoined(object sender, OnUserJoinedArgs e) { }
private async void OnUserJoined(object sender, OnUserJoinedArgs e) { if (!(sender is TwitchClient senderClient)) { return; } GetUsersResponse resp = await LeTwitchBot.BotAPI.Helix.Users.GetUsersAsync(null, new List <string> { senderClient.TwitchUsername }); if (resp.Users.Length <= 0) { return; } User user = resp.Users[0]; int userid = int.Parse(user.Id); ChannelVisitor existingVisitor; await using (Storage storage = new Storage()) { existingVisitor = storage.Visitors.FirstOrDefault(u => u.TwitchID == userid); if (existingVisitor == null) { Visit newVisit = new Visit { VisitDate = DateTime.Now }; ChannelVisitor newVisitor = new ChannelVisitor { TwitchUsername = user.DisplayName, TwitchID = userid, Visits = new List <Visit> { newVisit }, }; storage.Attach(newVisitor); } else { Visit newVisit = new Visit { Visitor = existingVisitor, VisitDate = DateTime.Now }; storage.Add(newVisit); } await storage.SaveChangesAsync(); } if (existingVisitor == null) { LeTwitchBot.TwitchClient.SendHostChannelMessage($"{senderClient.TwitchUsername} joined the stream for the first time. Welcome!!"); } }
private void onUserJoined(object sender, OnUserJoinedArgs e) { listBox5.Items.Add(e.Username); }
private void Client_OnUserJoined(object sender, OnUserJoinedArgs e) { Console.WriteLine("Usuario: {0} entrou as {1}", e.Username, DateTime.Now.ToString()); }
private void TwitchClient_OnUserJoined(object sender, OnUserJoinedArgs e) { allViewers.UserJoined(e.Username); }
/// <summary> /// Passes <see cref="OnUserJoined"/> events down to subscribed plugins. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An <see cref="OnUserJoinedArgs"/> object.</param> private void TwitchClient_OnUserJoined(object sender, OnUserJoinedArgs e) => this.OnUserJoined?.Invoke(this, e);