CardsAgainstIRC3.Game.States.Base.BotVoteCommand C# (CSharp) Method

BotVoteCommand() private method

private BotVoteCommand ( CommandContext context, IEnumerable arguments ) : void
context CommandContext
arguments IEnumerable
return void
        public void BotVoteCommand(CommandContext context, IEnumerable<string> arguments)
        {
            if (arguments.Count() < 1 || arguments.Count() > 2)
            {
                SendInContext(context, "Usage: !bot vote bot_name [should_be_able_to_vote]");
                return;
            }

            var bot = Manager.Resolve("<" + arguments.First() + ">");
            if (bot == null)
            {
                SendInContext(context, "That is not a bot!");
                return;
            }

            if (arguments.Count() == 2)
            {
                bot.CanVote = arguments.ElementAt(1).IsTruthy();
                if (bot.CanVote && !bot.Bot.CanVote)
                {
                    SendInContext(context, "The bot doesn't support voting!");
                    bot.CanVote = false;
                    return;
                }
            }

            Manager.SendPublic(context.Nick, "<{0}> Can{1} vote.", arguments.First(), bot.CanVote ? "" : "not");
        }