From 28f8ffd199d7527c99da7c3765f3f58be9c37e06 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 29 Jul 2024 21:32:33 +0300 Subject: [PATCH] Add td_api::chatInviteLinkSubscriptionInfo. --- td/generate/scheme/td_api.tl | 10 +++++++--- td/telegram/DialogInviteLinkManager.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 7e297ea4a..ca4d3a495 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1260,6 +1260,11 @@ inviteLinkChatTypeSupergroup = InviteLinkChatType; inviteLinkChatTypeChannel = InviteLinkChatType; +//@description Contains information about subscription plan that must be paid by the user to use a chat invite link +//@pricing Information about subscription plan that must be paid by the user to use the link +//@form_id Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid +chatInviteLinkSubscriptionInfo pricing:starSubscriptionPricing form_id:int64 = ChatInviteLinkSubscriptionInfo; + //@description Contains information about a chat invite link //@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining //@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds @@ -1270,14 +1275,13 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@param_description Chat description //@member_count Number of members in the chat //@member_user_ids User identifiers of some chat members that may be known to the current user -//@subscription_pricing Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription -//@subscription_form_id Identifier of the payment form to use for subscription payment +//@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup //@is_verified True, if the chat is verified //@is_scam True, if many users reported this chat as a scam //@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_pricing:starSubscriptionPricing subscription_form_id:int64 creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user diff --git a/td/telegram/DialogInviteLinkManager.cpp b/td/telegram/DialogInviteLinkManager.cpp index 7fec57da7..82fb78dec 100644 --- a/td/telegram/DialogInviteLinkManager.cpp +++ b/td/telegram/DialogInviteLinkManager.cpp @@ -791,8 +791,7 @@ td_api::object_ptr DialogInviteLinkManager::get_chat string description; int32 participant_count = 0; vector member_user_ids; - td_api::object_ptr subscription_pricing; - int64 subscription_form_id = 0; + td_api::object_ptr subscription_info; bool creates_join_request = false; bool is_public = false; bool is_member = false; @@ -842,9 +841,10 @@ td_api::object_ptr DialogInviteLinkManager::get_chat participant_count = invite_link_info->participant_count; member_user_ids = td_->user_manager_->get_user_ids_object(invite_link_info->participant_user_ids, "get_chat_invite_link_info_object"); - subscription_pricing = invite_link_info->subscription_pricing.get_star_subscription_pricing_object(); + auto subscription_pricing = invite_link_info->subscription_pricing.get_star_subscription_pricing_object(); if (subscription_pricing != nullptr) { - subscription_form_id = invite_link_info->subscription_form_id; + subscription_info = td_api::make_object( + std::move(subscription_pricing), invite_link_info->subscription_form_id); } creates_join_request = invite_link_info->creates_join_request; is_public = invite_link_info->is_public; @@ -873,8 +873,8 @@ td_api::object_ptr DialogInviteLinkManager::get_chat return td_api::make_object( td_->dialog_manager_->get_chat_id_object(dialog_id, "chatInviteLinkInfo"), accessible_for, std::move(chat_type), title, get_chat_photo_info_object(td_->file_manager_.get(), photo), accent_color_id_object, description, - participant_count, std::move(member_user_ids), std::move(subscription_pricing), subscription_form_id, - creates_join_request, is_public, is_verified, is_scam, is_fake); + participant_count, std::move(member_user_ids), std::move(subscription_info), creates_join_request, is_public, + is_verified, is_scam, is_fake); } void DialogInviteLinkManager::add_dialog_access_by_invite_link(DialogId dialog_id, const string &invite_link,