Add supergroupFullInfo.can_have_sponsored_messages.

This commit is contained in:
levlam 2024-04-02 14:32:00 +03:00
parent bd8c6be0cd
commit b987e84d54
3 changed files with 12 additions and 4 deletions

View File

@ -1187,6 +1187,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe
//@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup
//@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available,
//-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators
//@can_have_sponsored_messages True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat
//@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 supergroup or channel has pinned stories
//@my_boost_count Number of times the current user boosted the supergroup or channel
@ -1198,7 +1199,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 my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector<botCommands> 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 can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector<botCommands> upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo;
//@class SecretChatState @description Describes the current secret chat state

View File

@ -2206,6 +2206,7 @@ void ChatManager::ChannelFull::store(StorerT &storer) const {
STORE_FLAG(has_emoji_sticker_set);
STORE_FLAG(has_boost_count);
STORE_FLAG(has_unrestrict_boost_count);
STORE_FLAG(can_have_sponsored_messages);
END_STORE_FLAGS();
}
if (has_description) {
@ -2333,6 +2334,7 @@ void ChatManager::ChannelFull::parse(ParserT &parser) {
PARSE_FLAG(has_emoji_sticker_set);
PARSE_FLAG(has_boost_count);
PARSE_FLAG(has_unrestrict_boost_count);
PARSE_FLAG(can_have_sponsored_messages);
END_PARSE_FLAGS();
}
if (has_description) {
@ -5291,6 +5293,7 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
auto can_set_sticker_set = channel->can_set_stickers_;
auto can_set_location = channel->can_set_location_;
auto is_all_history_available = !channel->hidden_prehistory_;
auto can_have_sponsored_messages = !channel->restricted_sponsored_;
auto has_aggressive_anti_spam_enabled = channel->antispam_;
auto can_view_statistics = channel->can_view_stats_;
bool has_pinned_stories = channel->stories_pinned_available_;
@ -5326,6 +5329,7 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
channel_full->can_view_statistics != can_view_statistics || channel_full->stats_dc_id != stats_dc_id ||
channel_full->sticker_set_id != sticker_set_id || channel_full->emoji_sticker_set_id != emoji_sticker_set_id ||
channel_full->is_all_history_available != is_all_history_available ||
channel_full->can_have_sponsored_messages != can_have_sponsored_messages ||
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->boost_count != boost_count ||
@ -5343,6 +5347,7 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
channel_full->sticker_set_id = sticker_set_id;
channel_full->emoji_sticker_set_id = emoji_sticker_set_id;
channel_full->is_all_history_available = is_all_history_available;
channel_full->can_have_sponsored_messages = can_have_sponsored_messages;
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;
@ -8787,9 +8792,10 @@ tl_object_ptr<td_api::supergroupFullInfo> ChatManager::get_supergroup_full_info_
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->boost_count,
channel_full->unrestrict_boost_count, channel_full->sticker_set_id.get(),
channel_full->emoji_sticker_set_id.get(), channel_full->location.get_chat_location_object(),
channel_full->can_have_sponsored_messages, channel_full->has_aggressive_anti_spam_enabled,
channel_full->has_pinned_stories, channel_full->boost_count, channel_full->unrestrict_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(td_->user_manager_.get()), std::move(bot_commands),
get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_supergroup_full_info_object"),
channel_full->migrated_from_max_message_id.get());

View File

@ -576,6 +576,7 @@ class ChatManager final : public Actor {
bool can_view_statistics = false;
bool is_can_view_statistics_inited = false;
bool is_all_history_available = true;
bool can_have_sponsored_messages = true;
bool has_aggressive_anti_spam_enabled = false;
bool can_be_deleted = false;
bool has_pinned_stories = false;