Exemplo n.º 1
0
 public ConnectionManager(
     SupporterRepo supporterRepo,
     ConnectionRepo connectionRepo,
     StateManager stateManager,
     ITelegramBotClient telegramClient,
     ConnectionNotifier connectionNotifier)
 {
     SupporterRepo      = supporterRepo;
     ConnectionRepo     = connectionRepo;
     StateManager       = stateManager;
     TelegramClient     = telegramClient;
     ConnectionNotifier = connectionNotifier;
 }
Exemplo n.º 2
0
        public WaitingManager(
            WaitingQueueRepo waitingQueueRepo,
            ConnectionManager connectionManager,
            ITelegramBotClient telegramClient,
            SubscriberRepo subscriberRepo,
            StateManager stateManager,
            ConnectionNotifier connectionNotifier)
        {
            WaitingQueueRepo  = waitingQueueRepo;
            ConnectionManager = connectionManager;
            TelegramClient    = telegramClient;
            SubscriberRepo    = subscriberRepo;
            StateManager      = stateManager;

            connectionNotifier.NotifyOnCustomerDisconnect(CustomerDisconnected);
        }
Exemplo n.º 3
0
        public void Disconnect(SubscriberRecord customer)
        {
            var supporterChatId = ConnectionRepo.FindPartyChatId(customer);

            if (supporterChatId != default(long))
            {
                ConnectionRepo.RemoveByCustomer(customer);

                TelegramClient.SendTextMessageAsync(supporterChatId, $"You're Disconnected from {customer.FirstName} {customer.LastName}");
                TelegramClient.SendTextMessageAsync(customer.ChatId, "You're Disconnected.",
                                                    replyMarkup: StateManager.GetCustomerReplyKeyboardMarkup(customer));

                ConnectionNotifier.CustomerDisconnected();
            }
            else
            {
                TelegramClient.SendTextMessageAsync(customer.ChatId, "No session to end.",
                                                    replyMarkup: StateManager.GetCustomerReplyKeyboardMarkup(customer));
            }
        }