Ejemplo n.º 1
0
        public override void ExecuteValidCommand(MessageEventArgs messageEvent, string token)
        {
            var messageSplit = messageEvent.Message.Text.Split(' ');

            var           username      = messageSplit.ElementAt(1);
            var           password      = messageSplit.ElementAt(2);
            ApiDataAccess apiDataAccess = new ApiDataAccess();
            var           newToken      = apiDataAccess.Login(username, password);

            string response;

            if (newToken != null)
            {
                sessionManager.AddSesion(messageEvent.Message.Chat.Id, newToken);
                response = "You are now logged in, what do you want to do?";
            }
            else
            {
                response = "Incorrect username or password";
            }

            var chatId   = messageEvent.Message.Chat.Id;
            var keyboard = messageSender.CreateMenuKeyboard();

            messageSender.SendMessage(chatId, response, keyboard);
        }