IEnumerator ProcessTwitchCommand(string command) { string[] parameters = command.Split(' '); if (!Interactable) { yield return("sendtochaterror You can not interact with the module currently. The command was not processed."); yield break; } if (Regex.IsMatch(parameters[0], @"^\s*submit\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (parameters.Length != 2) { yield return("sendtochaterror Parameter length invalid. The command was not processed."); yield break; } if (parameters[1].Length < 1 || parameters[1].Length > 102) { yield return("sendtochaterror Number length invalid. The command was not processed."); yield break; } if (parameters[1].ToCharArray().Count(c => c == '-') > 1) { yield return("sendtochaterror Negative sign is more than 1. The command was not processed."); yield break; } if (parameters[1].ToCharArray().Count(c => c == '-') == 1 && parameters[1][0].ToString() != "-") { yield return("sendtochaterror Negative sign is not in the proper position. The command was not processed."); yield break; } for (int x = 0; x < parameters[1].Length; x++) { if (!parameters[1][x].ToString().EqualsAny(ValidStuff)) { yield return("sendtochaterror Number being sent contains an invalid character. The command was not processed."); yield break; } } for (int x = 0; x < parameters[1].Length; x++) { if (parameters[1][x].ToString() == "-") { Negative.OnInteract(); } else { Buttons[Int32.Parse(parameters[1][x].ToString())].OnInteract(); } yield return(new WaitForSeconds(0.05f)); } yield return("solve"); yield return("strike"); Display.OnInteract(); } }