protected bool SendToTwitchChat(string message, string userNickName) { // Within the messages, allow variables: // {0} = user’s nickname // {1} = Code (module number) if (message.RegexMatch(out Match match, @"^senddelayedmessage ([0-9]+(?:\.[0-9])?) (\S(?:\S|\s)*)$") && float.TryParse(match.Groups[1].Value, out float messageDelayTime)) { ComponentHandle.StartCoroutine(SendDelayedMessage(messageDelayTime, string.Format(match.Groups[3].Value, userNickName, ComponentHandle.Code))); return(true); } if (!message.RegexMatch(out match, @"^(sendtochat|sendtochaterror|strikemessage) +(\S(?:\S|\s)*)$")) { return(false); } var chatMsg = string.Format(match.Groups[2].Value, userNickName, ComponentHandle.Code); switch (match.Groups[1].Value) { case "sendtochat": IRCConnection.Instance.SendMessage(chatMsg); return(true); case "sendtochaterror": ComponentHandle.CommandError(userNickName, chatMsg); return(true); case "strikemessage": StrikeMessage = chatMsg; return(true); default: return(false); } }