public ConnectionManager( SupporterRepo supporterRepo, ConnectionRepo connectionRepo, StateManager stateManager, ITelegramBotClient telegramClient, ConnectionNotifier connectionNotifier) { SupporterRepo = supporterRepo; ConnectionRepo = connectionRepo; StateManager = stateManager; TelegramClient = telegramClient; ConnectionNotifier = connectionNotifier; }
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); }
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)); } }