Esempio n. 1
0
 protected virtual void OnUserTimedOut(TwitchUserTimeout userTimeout)
 {
     UserTimedOut?.Invoke(this, new UserTimedOutEventArgs(userTimeout));
 }
Esempio n. 2
0
        protected override void OnUnprocessedIrcMessageReceived(IrcMessage message)
        {
            switch (message.Command)
            {
            case "GLOBALUSERSTATE":
                var globalUserState = new TwitchGlobalUserState(message);
                OnGlobalUserStateReceived(globalUserState);
                break;

            case "PRIVMSG":
                if (message.GetUserName().Equals("jtv"))
                {
                    var hostedChannel = new TwitchHostedChannel(message);
                    OnChannelBeingHosted(hostedChannel);
                }
                else
                {
                    var chatMessage = new TwitchChatMessage(message);
                    OnChatMessageReceived(chatMessage);
                }
                break;

            case "WHISPER":
                var whisperMessage = new TwitchWhisperMessage(message);
                OnWhisperMessageReceived(whisperMessage);
                break;

            case "ROOMSTATE":
                var channelState = new TwitchChannelState(message);
                OnChannelStateChanged(channelState);
                break;

            case "USERSTATE":
                var userState = new TwitchUserState(message);
                OnUserStateReceived(userState);
                break;

            case "USERNOTICE":
                FireAnEventBasedOnUserNoticeType(message);
                break;

            case "HOSTTARGET":
                var channelHost = new TwitchChannelHost(message);
                if (!string.IsNullOrEmpty(channelHost.TargetChannel))
                {
                    OnChannelHostingStarted(channelHost);
                }
                else
                {
                    OnChannelHostingStopped(channelHost);
                }
                break;

            case "CLEARCHAT":
                if (message.Tags.ContainsKey("ban-duration"))
                {
                    var userTimeout = new TwitchUserTimeout(message);
                    OnUserTimedOut(userTimeout);
                }
                else if (message.Tags.ContainsKey("ban-reason"))
                {
                    var userBan = new TwitchUserBan(message);
                    OnUserBanned(userBan);
                }
                else
                {
                    string channel = message.GetChannel();
                    OnChatCleared(channel);
                }
                break;

            default:
                base.OnUnprocessedIrcMessageReceived(message);
                break;
            }
        }
 public UserTimedOutEventArgs(TwitchUserTimeout userTimeout)
 {
     UserTimeout = userTimeout;
 }