Add botInfo.privacy_policy_url.

This commit is contained in:
levlam 2024-08-12 15:35:12 +03:00
parent f9dcb217d0
commit e579dd6823
3 changed files with 20 additions and 2 deletions

View File

@ -1070,6 +1070,7 @@ user id:int53 first_name:string last_name:string usernames:usernames phone_numbe
//@animation Animation shown in the chat with the bot if the chat is empty; may be null
//@menu_button Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown
//@commands List of the bot commands
//@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened
//@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null
//@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null
//@has_media_previews True, if the bot has media previews
@ -1077,7 +1078,7 @@ user id:int53 first_name:string last_name:string usernames:usernames phone_numbe
//@edit_description_link The internal link, which can be used to edit bot description; may be null
//@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null
//@edit_settings_link The internal link, which can be used to edit bot settings; may be null
botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector<botCommand> default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo;
botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector<botCommand> privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo;
//@description Contains full information about a user
//@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown.

View File

@ -1684,6 +1684,7 @@ void UserManager::UserFull::store(StorerT &storer) const {
bool has_birthdate = !birthdate.is_empty();
bool has_personal_channel_id = personal_channel_id.is_valid();
bool has_flags2 = true;
bool has_privacy_policy_url = !privacy_policy_url.empty();
BEGIN_STORE_FLAGS();
STORE_FLAG(has_about);
STORE_FLAG(is_blocked);
@ -1719,6 +1720,7 @@ void UserManager::UserFull::store(StorerT &storer) const {
if (has_flags2) {
BEGIN_STORE_FLAGS();
STORE_FLAG(has_preview_medias);
STORE_FLAG(has_privacy_policy_url);
END_STORE_FLAGS();
}
if (has_about) {
@ -1772,6 +1774,9 @@ void UserManager::UserFull::store(StorerT &storer) const {
if (has_personal_channel_id) {
store(personal_channel_id, storer);
}
if (has_privacy_policy_url) {
store(privacy_policy_url, storer);
}
}
template <class ParserT>
@ -1794,6 +1799,7 @@ void UserManager::UserFull::parse(ParserT &parser) {
bool has_birthdate;
bool has_personal_channel_id;
bool has_flags2;
bool has_privacy_policy_url = false;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_about);
PARSE_FLAG(is_blocked);
@ -1829,6 +1835,7 @@ void UserManager::UserFull::parse(ParserT &parser) {
if (has_flags2) {
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_preview_medias);
PARSE_FLAG(has_privacy_policy_url);
END_PARSE_FLAGS();
}
if (has_about) {
@ -1882,6 +1889,9 @@ void UserManager::UserFull::parse(ParserT &parser) {
if (has_personal_channel_id) {
parse(personal_channel_id, parser);
}
if (has_privacy_policy_url) {
parse(privacy_policy_url, parser);
}
}
template <class StorerT>
@ -6946,6 +6956,11 @@ void UserManager::on_get_user_full(telegram_api::object_ptr<telegram_api::userFu
on_update_user_full_commands(user_full, user_id, std::move(user->bot_info_->commands_));
on_update_user_full_menu_button(user_full, user_id, std::move(user->bot_info_->menu_button_));
on_update_user_full_has_preview_medias(user_full, user_id, std::move(user->bot_info_->has_preview_medias_));
if (user_full->privacy_policy_url != user->bot_info_->privacy_policy_url_) {
user_full->privacy_policy_url = std::move(user->bot_info_->privacy_policy_url_);
user_full->is_changed = true;
}
}
if (user_full->description != description) {
user_full->description = std::move(description);
@ -7224,6 +7239,7 @@ void UserManager::drop_user_full(UserId user_id) {
user_full->birthdate = {};
user_full->sponsored_enabled = false;
user_full->has_preview_medias = false;
user_full->privacy_policy_url = string();
user_full->is_changed = true;
update_user_full(user_full, user_id, "drop_user_full");
@ -7956,7 +7972,7 @@ td_api::object_ptr<td_api::userFullInfo> UserManager::get_user_full_info_object(
user_full->about, user_full->description,
get_photo_object(td_->file_manager_.get(), user_full->description_photo),
td_->animations_manager_->get_animation_object(user_full->description_animation_file_id),
std::move(menu_button), std::move(commands),
std::move(menu_button), std::move(commands), user_full->privacy_policy_url,
user_full->group_administrator_rights == AdministratorRights()
? nullptr
: user_full->group_administrator_rights.get_chat_administrator_rights_object(),

View File

@ -587,6 +587,7 @@ class UserManager final : public Actor {
unique_ptr<BotMenuButton> menu_button;
vector<BotCommand> commands;
string privacy_policy_url;
AdministratorRights group_administrator_rights;
AdministratorRights broadcast_administrator_rights;