diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 34d7dc8f7..fe5a5fd62 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1241,12 +1241,14 @@ 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 //@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 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_pricing:starSubscriptionPricing subscription_form_id:int64 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 85de8e61e..ebb57f8fc 100644 --- a/td/telegram/DialogInviteLinkManager.cpp +++ b/td/telegram/DialogInviteLinkManager.cpp @@ -730,6 +730,8 @@ void DialogInviteLinkManager::on_get_dialog_invite_link_info( invite_link_info->description = std::move(chat_invite->about_); invite_link_info->participant_count = chat_invite->participants_count_; invite_link_info->participant_user_ids = std::move(participant_user_ids); + invite_link_info->subscription_pricing = StarSubscriptionPricing(std::move(chat_invite->subscription_pricing_)); + invite_link_info->subscription_form_id = chat_invite->subscription_form_id_; invite_link_info->creates_join_request = std::move(chat_invite->request_needed_); invite_link_info->is_chat = !chat_invite->channel_; invite_link_info->is_channel = chat_invite->channel_; @@ -772,7 +774,7 @@ td_api::object_ptr DialogInviteLinkManager::get_chat return nullptr; } - auto invite_link_info = it->second.get(); + const auto *invite_link_info = it->second.get(); CHECK(invite_link_info != nullptr); DialogId dialog_id = invite_link_info->dialog_id; @@ -785,6 +787,8 @@ 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; bool creates_join_request = false; bool is_public = false; bool is_member = false; @@ -834,6 +838,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(); + if (subscription_pricing != nullptr) { + subscription_form_id = invite_link_info->subscription_form_id; + } creates_join_request = invite_link_info->creates_join_request; is_public = invite_link_info->is_public; is_verified = invite_link_info->is_verified; @@ -861,7 +869,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), creates_join_request, is_public, is_verified, is_scam, is_fake); + 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); } void DialogInviteLinkManager::add_dialog_access_by_invite_link(DialogId dialog_id, const string &invite_link, diff --git a/td/telegram/DialogInviteLinkManager.h b/td/telegram/DialogInviteLinkManager.h index b9f72711b..a8d84b650 100644 --- a/td/telegram/DialogInviteLinkManager.h +++ b/td/telegram/DialogInviteLinkManager.h @@ -9,6 +9,7 @@ #include "td/telegram/AccentColorId.h" #include "td/telegram/DialogId.h" #include "td/telegram/Photo.h" +#include "td/telegram/StarSubscriptionPricing.h" #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" #include "td/telegram/UserId.h" @@ -113,6 +114,8 @@ class DialogInviteLinkManager final : public Actor { int32 participant_count = 0; vector participant_user_ids; string description; + StarSubscriptionPricing subscription_pricing; + int64 subscription_form_id; bool creates_join_request = false; bool is_chat = false; bool is_channel = false;