Apply bot menu button update to non-loaded users.

This commit is contained in:
levlam 2022-04-08 04:02:25 +03:00
parent 0c9e72a00a
commit 2b3d3c5efd
2 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,9 @@ class GetBotMenuButtonQuery final : public Td::ResultHandler {
return on_error(result_ptr.move_as_error()); return on_error(result_ptr.move_as_error());
} }
auto bot_menu_button = get_bot_menu_button(result_ptr.move_as_ok()); auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for GetBotMenuButtonQuery: " << to_string(ptr);
auto bot_menu_button = get_bot_menu_button(std::move(ptr));
promise_.set_value(bot_menu_button == nullptr ? td_api::make_object<td_api::botMenuButton>() promise_.set_value(bot_menu_button == nullptr ? td_api::make_object<td_api::botMenuButton>()
: bot_menu_button->get_bot_menu_button_object(td_)); : bot_menu_button->get_bot_menu_button_object(td_));
} }

View File

@ -6197,14 +6197,14 @@ void ContactsManager::on_update_bot_menu_button(UserId bot_user_id,
LOG(ERROR) << "Receive updateBotCOmmands about invalid " << bot_user_id; LOG(ERROR) << "Receive updateBotCOmmands about invalid " << bot_user_id;
return; return;
} }
if (!have_user(bot_user_id) || !is_user_bot(bot_user_id)) { if (!have_user_force(bot_user_id) || !is_user_bot(bot_user_id)) {
return; return;
} }
if (td_->auth_manager_->is_bot()) { if (td_->auth_manager_->is_bot()) {
return; return;
} }
auto user_full = get_user_full(bot_user_id); auto user_full = get_user_full_force(bot_user_id);
if (user_full != nullptr) { if (user_full != nullptr) {
on_update_user_full_menu_button(user_full, bot_user_id, std::move(bot_menu_button)); on_update_user_full_menu_button(user_full, bot_user_id, std::move(bot_menu_button));
update_user_full(user_full, bot_user_id, "on_update_bot_menu_button"); update_user_full(user_full, bot_user_id, "on_update_bot_menu_button");