Example #1
0
 /// <summary>
 /// Starts the chosen bot program
 /// </summary>
 /// <param name="botProgram">bot program to start</param>
 private void RunBotProgram(Button startButton)
 {
     CollectStartParams();
     RunningBot = BotRegistry.GetSelectedBot(RunParams, RunParams.BotManager);
     SetActiveState(startButton);
     RunningBot.Start();
     UpdateTimer.Enabled = true;
 }
Example #2
0
        public IHttpActionResult GetMove(string botName, MoveRequest request)
        {
            var    botKey = request.State.GameId + request.Player;
            IRobot robot  = BotRegistry.GetBot(botName, botKey);

            if (robot != null)
            {
                try
                {
                    var moves = robot.GetMoves(request);
                    return(Ok(moves));
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Message));
                }
            }
            return(BadRequest("Could not find bot named " + botName));
        }
Example #3
0
        private async Task MainAsync()
        {
            BotRegistry.FillRegistry();
            GuildRegistry.FillRegistry();

            _client = new DiscordSocketClient();

            await InitHandler.HandleInit(_client);

            var commandConfig = new CommandServiceConfig {
                DefaultRunMode = RunMode.Async
            };
            var commandHandler = new CommandHandler(_client, new CommandService(commandConfig));
            await commandHandler.InstallCommandsAsync();

            var reactionHandler = new ReactionHandler();

            reactionHandler.HandleReactions(_client);

            await Task.Delay(-1);
        }