From 5b4b54a17768811a8b1076687e7fc7a4a2f404b8 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 12 Dec 2018 18:38:20 +0300 Subject: [PATCH] Disable top chats for bots. GitOrigin-RevId: 0b7a28d335f35233a3c6c77b4b3cb4f58c160464 --- td/telegram/TopDialogManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/td/telegram/TopDialogManager.cpp b/td/telegram/TopDialogManager.cpp index 63c1b43b9..8fa9d5b86 100644 --- a/td/telegram/TopDialogManager.cpp +++ b/td/telegram/TopDialogManager.cpp @@ -6,6 +6,7 @@ // #include "td/telegram/TopDialogManager.h" +#include "td/telegram/AuthManager.h" #include "td/telegram/ConfigShared.h" #include "td/telegram/ContactsManager.h" #include "td/telegram/DialogId.h" @@ -459,7 +460,7 @@ void TopDialogManager::do_save_top_dialogs() { } void TopDialogManager::start_up() { - is_active_ = G()->parameters().use_chat_info_db; + is_active_ = G()->parameters().use_chat_info_db && !G()->td().get_actor_unsafe()->auth_manager_->is_bot(); is_enabled_ = !G()->shared_config().get_option_boolean("disable_top_chats"); update_rating_e_decay(); @@ -523,6 +524,10 @@ void TopDialogManager::init() { void TopDialogManager::on_first_sync() { was_first_sync_ = true; + if (G()->td().get_actor_unsafe()->auth_manager_->is_bot()) { + is_active_ = false; + init(); + } loop(); }