From 2037b049c551878aa4a40f6ed370a5ac1aa9a224 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 8 Feb 2024 18:51:40 +0300 Subject: [PATCH] Add supergroupFullInfo.my_boost_count. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/ContactsManager.cpp | 17 +++++++++++++++-- td/telegram/ContactsManager.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index aa61a4fc3..0ed96f4e0 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1103,6 +1103,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe //-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators //@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators //@has_pinned_stories True, if the channel has pinned stories +//@my_boost_count Number of times the current user boosted the supergroup or channel //@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none //@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none //@location Location to which the supergroup is connected; may be null if none @@ -1110,7 +1111,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 887edf45d..0c178a8f3 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4321,6 +4321,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const { bool has_bot_commands = !bot_commands.empty(); bool has_flags2 = true; bool has_emoji_sticker_set = emoji_sticker_set_id.is_valid(); + bool has_boost_count = boost_count != 0; BEGIN_STORE_FLAGS(); STORE_FLAG(has_description); STORE_FLAG(has_administrator_count); @@ -4357,6 +4358,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const { BEGIN_STORE_FLAGS(); STORE_FLAG(has_pinned_stories); STORE_FLAG(has_emoji_sticker_set); + STORE_FLAG(has_boost_count); END_STORE_FLAGS(); } if (has_description) { @@ -4412,6 +4414,9 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const { if (has_emoji_sticker_set) { store(emoji_sticker_set_id, storer); } + if (has_boost_count) { + store(boost_count, storer); + } } template @@ -4438,6 +4443,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) { bool has_bot_commands; bool has_flags2; bool has_emoji_sticker_set = false; + bool has_boost_count = false; BEGIN_PARSE_FLAGS(); PARSE_FLAG(has_description); PARSE_FLAG(has_administrator_count); @@ -4474,6 +4480,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) { BEGIN_PARSE_FLAGS(); PARSE_FLAG(has_pinned_stories); PARSE_FLAG(has_emoji_sticker_set); + PARSE_FLAG(has_boost_count); END_PARSE_FLAGS(); } if (has_description) { @@ -4537,6 +4544,9 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) { if (has_emoji_sticker_set) { parse(emoji_sticker_set_id, parser); } + if (has_boost_count) { + parse(boost_count, parser); + } if (legacy_can_view_statistics) { LOG(DEBUG) << "Ignore legacy can view statistics flag"; @@ -12209,6 +12219,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c auto has_aggressive_anti_spam_enabled = channel->antispam_; auto can_view_statistics = channel->can_view_stats_; bool has_pinned_stories = channel->stories_pinned_available_; + auto boost_count = channel->boost_count_; StickerSetId sticker_set_id; if (channel->stickerset_ != nullptr) { sticker_set_id = @@ -12241,7 +12252,8 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c channel_full->is_all_history_available != is_all_history_available || channel_full->has_aggressive_anti_spam_enabled != has_aggressive_anti_spam_enabled || channel_full->has_hidden_participants != has_hidden_participants || - channel_full->has_pinned_stories != has_pinned_stories) { + channel_full->has_pinned_stories != has_pinned_stories || + channel_full->boost_count != boost_count) { channel_full->participant_count = participant_count; channel_full->administrator_count = administrator_count; channel_full->restricted_count = restricted_count; @@ -12257,6 +12269,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c channel_full->is_all_history_available = is_all_history_available; channel_full->has_aggressive_anti_spam_enabled = has_aggressive_anti_spam_enabled; channel_full->has_pinned_stories = has_pinned_stories; + channel_full->boost_count = boost_count; channel_full->is_changed = true; } @@ -18169,7 +18182,7 @@ tl_object_ptr ContactsManager::get_supergroup_full_i can_hide_channel_participants(channel_id, channel_full).is_ok(), channel_full->can_set_sticker_set, channel_full->can_set_location, channel_full->can_view_statistics, can_toggle_channel_aggressive_anti_spam(channel_id, channel_full).is_ok(), channel_full->is_all_history_available, - channel_full->has_aggressive_anti_spam_enabled, channel_full->has_pinned_stories, + channel_full->has_aggressive_anti_spam_enabled, channel_full->has_pinned_stories, channel_full->boost_count, channel_full->sticker_set_id.get(), channel_full->emoji_sticker_set_id.get(), channel_full->location.get_chat_location_object(), channel_full->invite_link.get_chat_invite_link_object(this), std::move(bot_commands), diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 734eeb0e0..3d47353eb 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1038,6 +1038,7 @@ class ContactsManager final : public Actor { int32 administrator_count = 0; int32 restricted_count = 0; int32 banned_count = 0; + int32 boost_count = 0; DialogInviteLink invite_link;