Preload self user to process updateBotStopped.

This commit is contained in:
levlam 2023-11-08 17:04:51 +03:00
parent da9afda7e6
commit 3d163e8fb2
2 changed files with 12 additions and 2 deletions

View File

@ -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());

View File

@ -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<telegram_api::ChatParticipant> old_participant,
tl_object_ptr<telegram_api::ChatParticipant> new_participant);