Example #1
0
        public IActionResult Authentication()
        {
            var accounts = _botCredentials.GetAllAccounts();
            var model    = new BotAuthViewModel
            {
                SavedBotAccounts = accounts.Select(Mapper.Map <BotAccountViewModel>),
                BotIsRunning     = _bot.IsRunning()
            };

            return(View(model));
        }
Example #2
0
        public IActionResult Global()
        {
            if (!_bot.IsRunning())
            {
                return(RedirectToAction("Authentication", "Bot"));
            }

            var model = new ChatViewModel
            {
                AvailableServers = _bot.GetAvailableServers().Select(Mapper.Map <ServerDetailViewModel>),
                MessageBuffer    = new List <ChatMessageViewModel>()
            };

            return(View(model));
        }
Example #3
0
        public Task ToggleBotConnection()
        {
            if (_bot.IsRunning())
            {
                _bot.Stop();
            }
            else
            {
                _bot.Connect();
            }

            return(Task.CompletedTask);
        }
Example #4
0
        public IActionResult Index()
        {
            var model = new OverviewViewModel
            {
                BotIsRunning = _bot.IsRunning(),
                LogBuffer    = _logger.GetLatest(10)
            };

            var botAccount = _bot.GetActiveBotAccount();

            if (botAccount != null)
            {
                model.ActiveAccount = new BotAccountViewModel
                {
                    AvatarUrl = botAccount.AvatarUrl,
                    Name      = botAccount.Name
                };
            }

            return(View(model));
        }