private void OnMessage(object sender, TwitchChat.Message message)
 {
     if (message.Text.StartsWith("!"))
     {
         try
         {
             var splits = message.Text.Substring(1).Split(new char[] { ' ' }, 2);
             if (Commands.ContainsKey(splits[0].ToLower()))
             {
                 Commands[splits[0].ToLower()].Invoke(message.User, splits.Length > 1 ? splits[1] : "");
             }
         }
         catch (Exception e) { LogException(e); }
     }
 }
Пример #2
0
 private void OnMessage(object sender, TwitchChat.Message message)
 {
     if (message.Text.StartsWith("!"))
     {
         try
         {
             var splits = message.Text.Substring(1).Split(new char[] { ' ' }, 2);
             ExecuteCommand(Commands[splits[0]], message.User, splits.Length > 1 ? splits[1] : "");
         }
         catch { }
     }
     try
     {
         ExecuteCommand(Commands["anymessage"], message.User, message.Text);
     }
     catch { }
 }
 private void OnMessage(object sender, TwitchChat.Message message)
 {
     if (message.Text.StartsWith("!"))
     {
         try
         {
             var splits = message.Text.Substring(1).Split(new char[] { ' ' }, 2);
             if (Commands.ContainsKey(splits[0].ToLower()))
             {
                 Commands[splits[0].ToLower()].Invoke(message.User, splits.Length > 1 ? splits[1] : "");
             }
         }
         catch (Exception e) { LogException(e); }
     }
     //else try
     //{
     //    var cmd = Commands["anymessage"];
     //    if (cmd != null) {
     //        cmd.Invoke(message.User, "");
     //    }
     //}
     //catch (Exception e) { Log.Error(e); }
     /* ^ Is this code really useful ? ^ */
 }
Пример #4
0
 private void OnMessage(object sender, TwitchChat.Message message)
 {
     SendMessage("ok");
 }