Advertisement
EESweetieBot

[EE] Better and Stupider way to detect commands

Oct 30th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.28 KB | None | 0 0
  1. // Case: say
  2. string player = users[m.GetInt(0)].username;
  3. string msg = m.GetString(1);
  4. if(Regex.IsMatch(msg.SubString(0, 1), @"\.|\!"))
  5. {
  6.     var cmd = msg.Remove(0, 1).ToLower().ToString();
  7.     switch(cmd[0])
  8.     {
  9.         case "test":
  10.             {
  11.                 say("It's working!");
  12.             }
  13.             break;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement