Ejemplo n.º 1
0
 private void OnChatPartedTask(TwitchConnection obj, ChatUserListing listing, string msg)
 {
     foreach (KeyValuePair <string, RegisteredPlugin> kvp in RegisteredPlugins)
     {
         try
         {
             kvp.Value.OnChatParted(obj, listing, msg);
         }
         catch (Exception e)
         {
             Console.WriteLine($"An exception occured while trying to call OnChatParted for plugin {kvp.Key} (Exception: {e.ToString()})");
         }
     }
 }
Ejemplo n.º 2
0
        //These events don't work very well due to caching and they don't have much data to begin with. don't use them.
        private bool FilterJoinPart(string msg, string channel)
        {
            if (_joinRX.IsMatch(msg))
            {
                Task.Run(() => OnChatJoinedTask(this, msg));
            }

            if (_partRX.IsMatch(msg))
            {
                ChatUserListing partedUser = null;
                string          username   = "";
                try
                {
                    username   = _partRX.Match(msg).Groups["User"].Value;
                    partedUser = RoomStates[channel].UserList.FirstOrDefault(x => x.User.DisplayName == username);
                }
                catch (Exception e)
                {
                    _logger.Error(e);
                }

                if (partedUser.User != null)
                {
                    try
                    {
                        RoomStates[channel].RemoveUserFromList(username);
                        Task.Run(() => OnChatPartedTask(this, partedUser, msg));
                    }
                    catch (Exception e)
                    {
                        _logger.Error(e);
                    }
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
 public void OnChatParted(TwitchConnection obj, ChatUserListing user, string msg)
 {
     _onChatParted?.Invoke(obj, user.User);
 }