Beispiel #1
0
 /// <summary>
 /// Simple Constructor so that in derived classes you don't have to create a constructor
 /// </summary>
 /// <param name="bot"></param>
 /// <param name="raw"></param>
 public virtual void Init(Classes.BotBase bot, string raw)
 {
     this.bot = bot;
     this.raw = raw;
     this.raw = this.raw.TrimEnd('\r', '\n');
     time     = DateTime.UtcNow;
 }
Beispiel #2
0
        /// <summary>
        /// Parses the incoming message into the appropriate message class
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="msgStr"></param>
        /// <returns>Parsed message object</returns>
        public static Message ParseMessageString(Classes.BotBase bot, string msgStr)
        {
            // Parse Base Message
            Message msg = null;

            if (msgStr.StartsWith("@"))
            {
                // Has Tags
                msg = new TagsMessage();
            }
            else if (msgStr.StartsWith("PING"))
            {
                // Is Ping
                msg = new PingMessage();
            }
            else
            {
                // Doesn't Have Tags
                msg = new NoTagsMessage();
            }

            if (msg != null)
            {
                msg.Init(bot, msgStr);
            }

            return(msg);
        }