public string HandleCommand(string input) { if (string.IsNullOrEmpty(input)) { return(null); } string[] args = input.Split(' '); string botName; if (args.Length > 1) // If we have args[1] provided, use given botName { botName = args[1]; } else // If not, just pick first one { botName = Bot.GetAnyBotName(); } if (string.IsNullOrEmpty(botName)) { return("ERROR: Invalid botName: " + botName); } Bot bot; if (!Bot.Bots.TryGetValue(botName, out bot)) { return("ERROR: Couldn't find any bot named: " + botName); } Logging.LogGenericInfo("Received command: \"" + input + "\""); string command = '!' + input; string output = bot.HandleMessage(command).Result; // TODO: This should be asynchronous Logging.LogGenericInfo("Answered to command: \"" + input + "\" with: \"" + output + "\""); return(output); }