Add supergroupFullInfo.has_paid_media_allowed.

This commit is contained in:
levlam 2024-06-28 17:31:04 +03:00
parent fa49c93624
commit 0f4e9015e5
3 changed files with 14 additions and 7 deletions

View File

@ -1310,6 +1310,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 //-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 //@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_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_paid_media_allowed True, if paid media can be sent and forwarded to the channel chat; for channels only
//@has_pinned_stories True, if the supergroup or channel has pinned stories //@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 //@my_boost_count Number of times the current user boosted the supergroup or channel
//@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified //@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified
@ -1320,7 +1321,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe
//@bot_commands List of commands of bots in the group //@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_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 //@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_get_revenue_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; 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_get_revenue_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_paid_media_allowed: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 //@class SecretChatState @description Describes the current secret chat state
@ -3596,7 +3597,7 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration:
//@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent;
//@description A message with paid media; can be used only in channel chats //@description A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed
//@star_count The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") //@star_count The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max")
//@paid_media The content of the paid media //@paid_media The content of the paid media
//@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters

View File

@ -2268,6 +2268,7 @@ void ChatManager::ChannelFull::store(StorerT &storer) const {
STORE_FLAG(can_have_sponsored_messages); STORE_FLAG(can_have_sponsored_messages);
STORE_FLAG(can_view_revenue); STORE_FLAG(can_view_revenue);
STORE_FLAG(has_can_have_sponsored_messages); STORE_FLAG(has_can_have_sponsored_messages);
STORE_FLAG(has_paid_media_allowed);
END_STORE_FLAGS(); END_STORE_FLAGS();
} }
if (has_description) { if (has_description) {
@ -2399,6 +2400,7 @@ void ChatManager::ChannelFull::parse(ParserT &parser) {
PARSE_FLAG(can_have_sponsored_messages); PARSE_FLAG(can_have_sponsored_messages);
PARSE_FLAG(can_view_revenue); PARSE_FLAG(can_view_revenue);
PARSE_FLAG(has_can_have_sponsored_messages); PARSE_FLAG(has_can_have_sponsored_messages);
PARSE_FLAG(has_paid_media_allowed);
END_PARSE_FLAGS(); END_PARSE_FLAGS();
} }
if (has_description) { if (has_description) {
@ -5366,9 +5368,10 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
auto has_aggressive_anti_spam_enabled = channel->antispam_; auto has_aggressive_anti_spam_enabled = channel->antispam_;
auto can_view_statistics = channel->can_view_stats_; auto can_view_statistics = channel->can_view_stats_;
auto can_view_revenue = channel->can_view_revenue_; auto can_view_revenue = channel->can_view_revenue_;
bool has_pinned_stories = channel->stories_pinned_available_; auto has_pinned_stories = channel->stories_pinned_available_;
auto boost_count = channel->boosts_applied_; auto boost_count = channel->boosts_applied_;
auto unrestrict_boost_count = channel->boosts_unrestrict_; auto unrestrict_boost_count = channel->boosts_unrestrict_;
auto has_paid_media_allowed = channel->paid_media_allowed_;
StickerSetId sticker_set_id; StickerSetId sticker_set_id;
if (channel->stickerset_ != nullptr) { if (channel->stickerset_ != nullptr) {
sticker_set_id = sticker_set_id =
@ -5404,7 +5407,8 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
channel_full->has_hidden_participants != has_hidden_participants || channel_full->has_hidden_participants != has_hidden_participants ||
channel_full->has_pinned_stories != has_pinned_stories || channel_full->boost_count != boost_count || channel_full->has_pinned_stories != has_pinned_stories || channel_full->boost_count != boost_count ||
channel_full->unrestrict_boost_count != unrestrict_boost_count || channel_full->unrestrict_boost_count != unrestrict_boost_count ||
channel_full->can_view_revenue != can_view_revenue) { channel_full->can_view_revenue != can_view_revenue ||
channel_full->has_paid_media_allowed != has_paid_media_allowed) {
channel_full->participant_count = participant_count; channel_full->participant_count = participant_count;
channel_full->administrator_count = administrator_count; channel_full->administrator_count = administrator_count;
channel_full->restricted_count = restricted_count; channel_full->restricted_count = restricted_count;
@ -5424,6 +5428,7 @@ void ChatManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_
channel_full->boost_count = boost_count; channel_full->boost_count = boost_count;
channel_full->unrestrict_boost_count = unrestrict_boost_count; channel_full->unrestrict_boost_count = unrestrict_boost_count;
channel_full->can_view_revenue = can_view_revenue; channel_full->can_view_revenue = can_view_revenue;
channel_full->has_paid_media_allowed = has_paid_media_allowed;
channel_full->is_changed = true; channel_full->is_changed = true;
} }
@ -8884,9 +8889,9 @@ tl_object_ptr<td_api::supergroupFullInfo> ChatManager::get_supergroup_full_info_
channel_full->can_set_location, channel_full->can_view_statistics, channel_full->can_view_revenue, channel_full->can_set_location, channel_full->can_view_statistics, channel_full->can_view_revenue,
can_toggle_channel_aggressive_anti_spam(channel_id, channel_full).is_ok(), channel_full->is_all_history_available, can_toggle_channel_aggressive_anti_spam(channel_id, channel_full).is_ok(), channel_full->is_all_history_available,
channel_full->can_have_sponsored_messages, channel_full->has_aggressive_anti_spam_enabled, 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->has_paid_media_allowed, channel_full->has_pinned_stories, channel_full->boost_count,
channel_full->sticker_set_id.get(), channel_full->emoji_sticker_set_id.get(), channel_full->unrestrict_boost_count, channel_full->sticker_set_id.get(),
channel_full->location.get_chat_location_object(), 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), 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"), get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_supergroup_full_info_object"),
channel_full->migrated_from_max_message_id.get()); channel_full->migrated_from_max_message_id.get());

View File

@ -589,6 +589,7 @@ class ChatManager final : public Actor {
bool has_aggressive_anti_spam_enabled = false; bool has_aggressive_anti_spam_enabled = false;
bool can_be_deleted = false; bool can_be_deleted = false;
bool has_pinned_stories = false; bool has_pinned_stories = false;
bool has_paid_media_allowed = false;
bool is_slow_mode_next_send_date_changed = true; bool is_slow_mode_next_send_date_changed = true;
bool is_being_updated = false; bool is_being_updated = false;