Example #1
0
 public void ProcessMessage(string messageText, BotUser user)
 {
     switch (messageText)
     {
     default:
     {
         if (groupProvider.GetAllGroups().Contains(messageText.ToUpper()))
         {
             if (messageHandler.SaveGroup(messageText.ToUpper(), user))
             {
                 peopleParser.EvaluateState(user.UserId);
                 var updatedState = container.Get <RegisterTG>();
                 tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.SuccessfulRegistration).response, updatedState.GetKeyboard());
             }
             else
             {
                 tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.GroupError).response, GetKeyboard());
             }
         }
         else
         {
             tgUnknownMessageProcessor.ProcessUnknownCommand(messageText, user, GetKeyboard(), new MessageResponse(ResponseType.RegisterInProgressError));
         }
         break;
     }
     }
 }
Example #2
0
        public void ProcessMessage(string messageText, BotUser user)
        {
            switch (messageText)
            {
            case "расписание на сегодня":
            {
                messageHandler.GetScheduleForToday(user);
                break;
            }

            case "расписание на завтра":
            {
                messageHandler.GetScheduleForNextDay(user);
                break;
            }

            case var n when n == registerCommandListProvider.GettingDiningRoom:
            {
                var visitorsCount = messageHandler.GetDiningRoom(user);
                var text          = new MessageResponse(ResponseType.DiningRoom).response;
                tgMessageSender.SendNotification(user, text + visitorsCount, GetKeyboard());
                break;
            }

            case "ссылки на учебные чаты":
            {
                messageHandler.GetLinks(user);
                break;
            }

            case "добавить ссылку на чат":
            {
                peopleParser.ChangeState(user.UserId, UserStates.AddingLink);
                var newUserState = container.Get <AddingLinkTG>();
                tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.LinksMessage).response, newUserState.GetKeyboard());
                break;
            }

            default:
            {
                tgUnknownMessageProcessor.ProcessUnknownCommand(messageText, user, GetKeyboard(), new MessageResponse(ResponseType.RegisterError));
                break;
            }
            }
        }
        public void ProcessMessage(string messageText, BotUser user)
        {
            switch (messageText)
            {
            case "/start":
            case "start":
            case "начать":
            {
                var text = new MessageResponse(ResponseType.Start).response;
                peopleParser.AddNewUser(user.UserId, "tg");
                peopleParser.EvaluateState(user.UserId);
                var updatedState = container.Get <RegisterInProcessTG>();
                tgMessageSender.SendNotification(user, text, updatedState.GetKeyboard());
                break;
            }

            default:
                tgUnknownMessageProcessor.ProcessUnknownCommand(messageText, user, GetKeyboard(), new MessageResponse(ResponseType.NotRegisterError));
                break;
            }
        }