Add userTypeBot.has_main_web_app.

This commit is contained in:
levlam 2024-07-19 16:03:47 +03:00
parent f45258eb66
commit 26997e39c8
3 changed files with 14 additions and 4 deletions

View File

@ -571,13 +571,14 @@ userTypeDeleted = UserType;
//@can_be_edited True, if the bot is owned by the current user and can be edited using the methods toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, setBotInfoDescription, and setBotInfoShortDescription
//@can_join_groups True, if the bot can be invited to basic group and supergroup chats
//@can_read_all_group_messages True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages
//@has_main_web_app True, if the bot has main Web App
//@is_inline True, if the bot supports inline queries
//@inline_query_placeholder Placeholder for inline queries (displayed on the application input field)
//@need_location True, if the location of the user is expected to be sent with every inline query to this bot
//@can_connect_to_business True, if the bot supports connection to Telegram Business accounts
//@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu
//@active_user_count The number of recently active users of the bot
userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType;
userTypeBot can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType;
//@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type
userTypeUnknown = UserType;

View File

@ -1409,6 +1409,7 @@ void UserManager::User::store(StorerT &storer) const {
STORE_FLAG(contact_require_premium);
STORE_FLAG(is_business_bot);
STORE_FLAG(has_bot_active_users);
STORE_FLAG(has_main_app);
END_STORE_FLAGS();
}
store(first_name, storer);
@ -1541,6 +1542,7 @@ void UserManager::User::parse(ParserT &parser) {
PARSE_FLAG(contact_require_premium);
PARSE_FLAG(is_business_bot);
PARSE_FLAG(has_bot_active_users);
PARSE_FLAG(has_main_app);
END_PARSE_FLAGS();
}
parse(first_name, parser);
@ -2362,6 +2364,7 @@ void UserManager::on_get_user(telegram_api::object_ptr<telegram_api::User> &&use
bool can_join_groups = (flags & USER_FLAG_IS_PRIVATE_BOT) == 0;
bool can_read_all_group_messages = (flags & USER_FLAG_IS_BOT_WITH_PRIVACY_DISABLED) != 0;
bool can_be_added_to_attach_menu = (flags & USER_FLAG_IS_ATTACH_MENU_BOT) != 0;
bool has_main_app = user->bot_has_main_app_;
bool attach_menu_enabled = (flags & USER_FLAG_ATTACH_MENU_ENABLED) != 0;
bool is_scam = (flags & USER_FLAG_IS_SCAM) != 0;
bool can_be_edited_bot = (flags2 & USER_FLAG_CAN_BE_EDITED_BOT) != 0;
@ -2379,12 +2382,13 @@ void UserManager::on_get_user(telegram_api::object_ptr<telegram_api::User> &&use
bool contact_require_premium = user->contact_require_premium_;
if (!is_bot && (!can_join_groups || can_read_all_group_messages || can_be_added_to_attach_menu || can_be_edited_bot ||
is_inline_bot || is_business_bot)) {
has_main_app || is_inline_bot || is_business_bot)) {
LOG(ERROR) << "Receive not bot " << user_id << " with bot properties from " << source;
can_join_groups = true;
can_read_all_group_messages = false;
can_be_added_to_attach_menu = false;
can_be_edited_bot = false;
has_main_app = false;
is_inline_bot = false;
is_business_bot = false;
}
@ -2403,6 +2407,7 @@ void UserManager::on_get_user(telegram_api::object_ptr<telegram_api::User> &&use
can_read_all_group_messages = false;
can_be_added_to_attach_menu = false;
can_be_edited_bot = false;
has_main_app = false;
is_inline_bot = false;
is_business_bot = false;
inline_query_placeholder = string();
@ -2421,7 +2426,7 @@ void UserManager::on_get_user(telegram_api::object_ptr<telegram_api::User> &&use
is_scam != u->is_scam || is_fake != u->is_fake || is_inline_bot != u->is_inline_bot ||
is_business_bot != u->is_business_bot || inline_query_placeholder != u->inline_query_placeholder ||
need_location_bot != u->need_location_bot || can_be_added_to_attach_menu != u->can_be_added_to_attach_menu ||
bot_active_users != u->bot_active_users) {
bot_active_users != u->bot_active_users || has_main_app != u->has_main_app) {
if (is_bot != u->is_bot) {
LOG_IF(ERROR, !is_deleted && !u->is_deleted && u->is_received)
<< "User.is_bot has changed for " << user_id << "/" << u->usernames << " from " << source << " from "
@ -2441,6 +2446,7 @@ void UserManager::on_get_user(telegram_api::object_ptr<telegram_api::User> &&use
u->need_location_bot = need_location_bot;
u->can_be_added_to_attach_menu = can_be_added_to_attach_menu;
u->bot_active_users = bot_active_users;
u->has_main_app = has_main_app;
LOG(DEBUG) << "Info has changed for " << user_id;
u->is_changed = true;
@ -4134,6 +4140,7 @@ Result<UserManager::BotData> UserManager::get_bot_data(UserId user_id) const {
bot_data.can_be_edited = u->can_be_edited_bot;
bot_data.can_join_groups = u->can_join_groups;
bot_data.can_read_all_group_messages = u->can_read_all_group_messages;
bot_data.has_main_app = u->has_main_app;
bot_data.is_inline = u->is_inline_bot;
bot_data.is_business = u->is_business_bot;
bot_data.need_location = u->need_location_bot;
@ -7880,7 +7887,7 @@ td_api::object_ptr<td_api::user> UserManager::get_user_object(UserId user_id, co
type = td_api::make_object<td_api::userTypeDeleted>();
} else if (u->is_bot) {
type = td_api::make_object<td_api::userTypeBot>(
u->can_be_edited_bot, u->can_join_groups, u->can_read_all_group_messages, u->is_inline_bot,
u->can_be_edited_bot, u->can_join_groups, u->can_read_all_group_messages, u->has_main_app, u->is_inline_bot,
u->inline_query_placeholder, u->need_location_bot, u->is_business_bot, u->can_be_added_to_attach_menu,
u->bot_active_users);
} else {

View File

@ -213,6 +213,7 @@ class UserManager final : public Actor {
bool can_be_edited;
bool can_join_groups;
bool can_read_all_group_messages;
bool has_main_app;
bool is_inline;
bool is_business;
bool need_location;
@ -513,6 +514,7 @@ class UserManager final : public Actor {
bool can_join_groups = true;
bool can_read_all_group_messages = true;
bool can_be_edited_bot = false;
bool has_main_app = false;
bool is_inline_bot = false;
bool is_business_bot = false;
bool need_location_bot = false;