コード例 #1
0
        /// <summary>
        /// Constructs a TwitchResubEventArgs instance from a raw IRC message.
        /// </summary>
        /// <param name="rawMessage"></param>
        public TwitchResubEventArgs(string rawMessage)
        {
            var parsedMessage = rawMessage.Split(new[] { " :" }, StringSplitOptions.None);
            var parsedHeaders = TwitchMessageHelpers.ParseTwitchHeaders(parsedMessage[0]);

            Username = parsedHeaders["display-name"];
            Months   = int.Parse(parsedHeaders["msg-param-months"]);
            Message  = string.Join(" :", parsedMessage.Skip(2));
        }
コード例 #2
0
        /// <summary>
        /// Constructs a TwitchMessageEventArgs instance from a raw IRC message.
        /// </summary>
        /// <param name="rawMessage"></param>
        public TwitchMessageEventArgs(string rawMessage)
        {
            var parsedMessage = rawMessage.Split(new[] { " :" }, StringSplitOptions.None);
            var parsedHeaders = TwitchMessageHelpers.ParseTwitchHeaders(parsedMessage[0]);

            // If message contains ':'s we want to preserve them after splitting the raw message.
            Message = string.Join(" :", parsedMessage.Skip(2));

            Username   = parsedHeaders["display-name"];
            Color      = parsedHeaders["color"];
            Mod        = parsedHeaders["mod"].Equals("1") || parsedHeaders["room-id"].Equals(parsedHeaders["user-id"]);
            Subscriber = parsedHeaders["subscriber"].Equals("1");
            Turbo      = parsedHeaders["turbo"].Equals("1");
        }