Add get_attach_menu_bot_object.
This commit is contained in:
parent
8736193034
commit
a906c16cd4
|
@ -397,23 +397,26 @@ void AttachMenuManager::toggle_bot_is_added_to_attach_menu(UserId user_id, bool
|
|||
td_->create_handler<ToggleBotInAttachMenuQuery>(std::move(promise))->send(std::move(input_user), is_added);
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::attachMenuBot> AttachMenuManager::get_attach_menu_bot_object(
|
||||
const AttachMenuBot &bot) const {
|
||||
auto get_file = [td = td_](FileId file_id) -> td_api::object_ptr<td_api::file> {
|
||||
if (!file_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return td->file_manager_->get_file_object(file_id);
|
||||
};
|
||||
|
||||
return td_api::make_object<td_api::attachMenuBot>(
|
||||
td_->contacts_manager_->get_user_id_object(bot.user_id_, "get_attach_menu_bot_object"), bot.name_,
|
||||
get_file(bot.default_icon_file_id_), get_file(bot.ios_static_icon_file_id_),
|
||||
get_file(bot.ios_animated_icon_file_id_), get_file(bot.android_icon_file_id_), get_file(bot.macos_icon_file_id_));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::updateAttachMenuBots> AttachMenuManager::get_update_attach_menu_bots_object() const {
|
||||
CHECK(is_active());
|
||||
CHECK(is_inited_);
|
||||
auto bots = transform(attach_menu_bots_, [td = td_](const AttachMenuBot &bot) {
|
||||
auto get_file = [td](FileId file_id) -> td_api::object_ptr<td_api::file> {
|
||||
if (!file_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return td->file_manager_->get_file_object(file_id);
|
||||
};
|
||||
|
||||
return td_api::make_object<td_api::attachMenuBot>(
|
||||
td->contacts_manager_->get_user_id_object(bot.user_id_, "attachMenuBot"), bot.name_,
|
||||
get_file(bot.default_icon_file_id_), get_file(bot.ios_static_icon_file_id_),
|
||||
get_file(bot.ios_animated_icon_file_id_), get_file(bot.android_icon_file_id_),
|
||||
get_file(bot.macos_icon_file_id_));
|
||||
});
|
||||
auto bots =
|
||||
transform(attach_menu_bots_, [this](const AttachMenuBot &bot) { return get_attach_menu_bot_object(bot); });
|
||||
return td_api::make_object<td_api::updateAttachMenuBots>(std::move(bots));
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ class AttachMenuManager final : public Actor {
|
|||
|
||||
Result<AttachMenuBot> get_attach_menu_bot(tl_object_ptr<telegram_api::attachMenuBot> &&bot) const;
|
||||
|
||||
td_api::object_ptr<td_api::attachMenuBot> get_attach_menu_bot_object(const AttachMenuBot &bot) const;
|
||||
|
||||
td_api::object_ptr<td_api::updateAttachMenuBots> get_update_attach_menu_bots_object() const;
|
||||
|
||||
void send_update_attach_menu_bots() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user