Move bot-only fields in userFullInfo to class botInfo.

This commit is contained in:
levlam 2022-03-18 15:04:47 +03:00
parent 479667dd1a
commit fa4e17fe95
2 changed files with 15 additions and 7 deletions

View File

@ -439,6 +439,12 @@ inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputC
//@language_code IETF language tag of the user's language; only available to bots //@language_code IETF language tag of the user's language; only available to bots
user id:int53 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string = User; user id:int53 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string = User;
//@description Contains information about a bot
//@share_text The text that is shown on the bot's profile page and is sent together with the link when users share the bot
//@param_description The text shown in the chat with the bot if the chat is empty
//@commands List of the bot commands
botInfo share_text:string description:string commands:vector<botCommand> = BotInfo;
//@description Contains full information about a user //@description Contains full information about a user
//@photo User profile photo; may be null //@photo User profile photo; may be null
//@is_blocked True, if the user is blocked by the current user //@is_blocked True, if the user is blocked by the current user
@ -448,11 +454,9 @@ user id:int53 first_name:string last_name:string username:string phone_number:st
//@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings //@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings
//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used //@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
//@bio A short user bio //@bio A short user bio
//@share_text For bots, the text that is shown on the bot's profile page and is sent together with the link when users share the bot
//@param_description For bots, the text shown in the chat with the bot if the chat is empty
//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user
//@commands For bots, list of the bot commands //@bot_info For bots, information about the bot; may be null
userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool need_phone_number_privacy_exception:Bool bio:string share_text:string description:string group_in_common_count:int32 commands:vector<botCommand> = UserFullInfo; userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool need_phone_number_privacy_exception:Bool bio:string group_in_common_count:int32 bot_info:botInfo = UserFullInfo;
//@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers
users total_count:int32 user_ids:vector<int53> = Users; users total_count:int32 user_ids:vector<int53> = Users;

View File

@ -16221,14 +16221,18 @@ tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(U
tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(UserId user_id, tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(UserId user_id,
const UserFull *user_full) const { const UserFull *user_full) const {
CHECK(user_full != nullptr); CHECK(user_full != nullptr);
td_api::object_ptr<td_api::botInfo> bot_info;
bool is_bot = is_user_bot(user_id); bool is_bot = is_user_bot(user_id);
auto commands = transform(user_full->commands, [](const auto &command) { return command.get_bot_command_object(); }); if (is_bot) {
auto commands =
transform(user_full->commands, [](const auto &command) { return command.get_bot_command_object(); });
bot_info = td_api::make_object<td_api::botInfo>(user_full->about, user_full->description, std::move(commands));
}
return make_tl_object<td_api::userFullInfo>( return make_tl_object<td_api::userFullInfo>(
get_chat_photo_object(td_->file_manager_.get(), user_full->photo), user_full->is_blocked, get_chat_photo_object(td_->file_manager_.get(), user_full->photo), user_full->is_blocked,
user_full->can_be_called, user_full->supports_video_calls, user_full->has_private_calls, user_full->can_be_called, user_full->supports_video_calls, user_full->has_private_calls,
!user_full->private_forward_name.empty(), user_full->need_phone_number_privacy_exception, !user_full->private_forward_name.empty(), user_full->need_phone_number_privacy_exception,
is_bot ? string() : user_full->about, is_bot ? user_full->about : string(), is_bot ? string() : user_full->about, user_full->common_chat_count, std::move(bot_info));
is_bot ? user_full->description : string(), user_full->common_chat_count, std::move(commands));
} }
td_api::object_ptr<td_api::updateBasicGroup> ContactsManager::get_update_unknown_basic_group_object(ChatId chat_id) { td_api::object_ptr<td_api::updateBasicGroup> ContactsManager::get_update_unknown_basic_group_object(ChatId chat_id) {