public void BotAddCommand(CommandContext context, IEnumerable<string> arguments)
{
if (arguments.Count() < 1)
{
SendInContext(context, "Usage: !bot add name [nick [arguments]]");
return;
}
string botID = arguments.ElementAt(0);
if (!GameManager.Bots.ContainsKey(botID))
{
SendInContext(context, "Invalid bot!");
return;
}
string botNick = arguments.ElementAtOrDefault(1) ?? botID;
try
{
Manager.AddBot(botNick, (IBot)GameManager.Bots[botID].GetConstructor(new Type[] { typeof(GameManager), typeof(IEnumerable<string>) }).Invoke(new object[] { Manager, arguments.Skip(2) }));
Manager.SendPublic(context.Nick, "Added <{0}> (a bot of type {1})", botNick, botID);
}
catch (ArgumentException e)
{
SendInContext(context, "Error adding {0}: {1}", botNick, e.Message);
}
}