private static int CheckInput(string str) { foreach (Response r in Bot.GetResponses()) { if (r.Trigger.IsMatch(str)) { return(r.Id); } } return(-1); // -1 is an invalid ID used when a response is not found. }