Beispiel #1
0
        internal void ParseSpecialUser(TwitchChannel chan, string text, int offset)
        {
            //*  SPECIALUSER username subscriber

            string specialuser = "******";
            if (!text.StartsWith(specialuser, offset))
            {
                Debug.Fail("ParseSpecialUser received unexpected string start.");
                return;
            }

            offset += specialuser.Length;

            int i = text.IndexOf(' ', offset);
            string name = text.Slice(offset, i);

            if (text.EndsWith("subscriber"))
            {
                if (chan == null)
                {
                    Debug.Fail("Subscriber message sent to non-channel.");
                    return;
                }

                var user = chan.GetUser(name);
                user.IsSubscriber = true;
            }
            else if (text.EndsWith("turbo"))
            {
                var user = GetUserData(name);
                user.IsTurbo = true;
            }
            else if (text.EndsWith("admin"))
            {
                var user = GetUserData(name);
                user.IsAdmin = true;
            }
            else if (text.EndsWith("staff"))
            {
                var user = GetUserData(name);
                user.IsStaff = true;
            }
            else
            {
                Debug.Fail(string.Format("Parse SpecialMessage could not parse {0}", text));
            }
        }
 private void ModListReceivedWorker(TwitchChannel channel)
 {
     // Setting initial state, it's ok we haven't joined the channel yet.
     var currUser = CurrentUser = channel.GetUser(m_options.User);
     if (currUser.IsModerator)
         ModJoined(channel, currUser);
     else
         ModLeft(channel, currUser);
 }