示例#1
0
        /// <inheritdoc />
        public async Task StartAsync()
        {
            var botFilePaths = _botReader.GetBotFiles();

            if (!botFilePaths.Any())
            {
                ShowErrorMessage("No bots where found!");
            }

            // Loop trough all the bots and start them.
            foreach (var bot in botFilePaths)
            {
                _botReader.StoreBot(bot, true);
                var thread = new Thread(async() => await StartBotAsync(bot).ConfigureAwait(false));
                thread.Start();
            }

            await StartTimers().ConfigureAwait(false);

            while (true)
            {
                var userInput = Console.ReadLine();
                if (userInput == "exit")
                {
                    break;
                }
                if (userInput == null)
                {
                    continue;
                }
                switch (userInput.ToLower())
                {
                case "bots":
                    _commands.BotsCommand();
                    break;
                }
            }
        }