diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index f7b31d625..db54e5b4c 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -16817,7 +16817,7 @@ void ContactsManager::send_update_chat_member(DialogId dialog_id, UserId agent_u get_chat_member_object(new_dialog_participant, "send_update_chat_member new"))); } -void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped) { +void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped, bool force) { if (!td_->auth_manager_->is_bot()) { LOG(ERROR) << "Receive updateBotStopped by non-bot"; return; @@ -16826,6 +16826,16 @@ void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_ LOG(ERROR) << "Receive invalid updateBotStopped by " << user_id << " at " << date; return; } + if (!have_user_force(get_my_id(), "on_update_bot_stopped 2")) { + if (!force) { + send_get_me_query(td_, PromiseCreator::lambda([actor_id = actor_id(this), user_id, date, is_stopped](Unit) { + send_closure(actor_id, &ContactsManager::on_update_bot_stopped, user_id, date, is_stopped, + true); + })); + return; + } + LOG(ERROR) << "Have no self-user to process updateBotStopped"; + } DialogParticipant old_dialog_participant(DialogId(get_my_id()), user_id, date, DialogParticipantStatus::Banned(0)); DialogParticipant new_dialog_participant(DialogId(get_my_id()), user_id, date, DialogParticipantStatus::Member()); diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 6c1c5cb2c..f6f1c6135 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -251,7 +251,7 @@ class ContactsManager final : public Actor { void on_update_channel_default_permissions(ChannelId channel_id, RestrictedRights default_permissions); void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count); - void on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped); + void on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped, bool force = false); void on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link, tl_object_ptr old_participant, tl_object_ptr new_participant);