public TelegramBot GetBot(long chatId)
        {
            var filter = Builders <TelegramBotChat> .Filter.Eq("ChatId", chatId);

            TelegramBotChat chat = _chatStorage.Find(filter).FirstOrDefault();

            return(GetBot(chat.BotId));
        }
        private void ClientOnMessage(object sender, MessageEventArgs e)
        {
            ITelegramBotClient client       = sender as ITelegramBotClient;
            long            chatId          = e.Message.Chat.Id;
            TelegramBotChat telegramBotChat = _tlgBotStorage.GetChat(chatId);

            if (telegramBotChat == null)
            {
                telegramBotChat = new TelegramBotChat {
                    ChatId = chatId,
                    BotId  = client.BotId
                };
                _tlgBotStorage.StoreChat(telegramBotChat);
            }
        }
 public void StoreChat(TelegramBotChat botChat)
 {
     _chatStorage.InsertOne(botChat);
 }