bool HandleCommandCommon <T>(string msg, SteamID sender, SendChatDelegate sendChat, out T cmd) where T : struct { msg = msg.Trim(); cmd = default(T); string[] commands = msg.Split(' '); if (commands.Length == 0) { return(false); } string command = commands[0]; bool isNumeric = Regex.IsMatch(command, @"^\d+$"); if (isNumeric || !BotCommand.TryParse(command, true, out cmd)) { sendChat(sender, EChatEntryType.ChatMsg, "Unknown bot command."); return(false); } if (!CheckPermission(sender, cmd)) { sendChat(sender, EChatEntryType.ChatMsg, "You do not have permission for this command."); return(false); } return(true); }