Reload attach menu bots after adding or removing a bot.

This commit is contained in:
levlam 2022-03-29 15:48:21 +03:00
parent 5b81010f0b
commit 13975f4e54

View File

@ -496,7 +496,16 @@ void AttachMenuManager::toggle_bot_is_added_to_attach_menu(UserId user_id, bool
remove_bot_from_attach_menu(user_id);
}
td_->create_handler<ToggleBotInAttachMenuQuery>(std::move(promise))->send(std::move(input_user), is_added);
auto query_promise =
PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise)](Result<Unit> &&result) mutable {
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
send_closure(actor_id, &AttachMenuManager::reload_attach_menu_bots, std::move(promise));
}
});
td_->create_handler<ToggleBotInAttachMenuQuery>(std::move(query_promise))->send(std::move(input_user), is_added);
}
td_api::object_ptr<td_api::attachMenuBot> AttachMenuManager::get_attach_menu_bot_object(