Example #1
0
        public void ProcessMessage(string messageText, BotUser user)
        {
            if (addingLinkCommandListProvider.GetCommands().Contains(messageText))
            {
                var newUserState = container.Get <RegisterTG>();
                peopleParser.ChangeState(user.UserId, Infrastructure.UserStates.Register);
                tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.LinkCancel).response, newUserState.GetKeyboard());
            }

            else if (!messageText.Contains("http") && !messageText.Contains(":"))
            {
                tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.LinksError).response,
                                                 GetKeyboard());
            }

            else if (messageText.Contains("http") && messageText.Contains(":"))
            {
                var splittedMessage = messageText.Split(": ");
                var name            = splittedMessage[0];
                var link            = splittedMessage[1];
                messageHandler.AddLink(user, name, link);
                peopleParser.ChangeState(user.UserId, Infrastructure.UserStates.Register);
                var newUserState = container.Get <RegisterTG>();
                tgMessageSender.SendNotification(user, new MessageResponse(ResponseType.SucessfulLinks).response,
                                                 newUserState.GetKeyboard());
            }
            else
            {
                tgUnknownMessageProcessor.ProcessUnknownCommand(messageText, user, GetKeyboard(), new MessageResponse(ResponseType.Help));
            }
        }