Add starSubscription.can_reuse.

This commit is contained in:
levlam 2024-07-29 21:48:36 +03:00
parent 7e09507987
commit 5303570c76
3 changed files with 7 additions and 4 deletions

View File

@ -807,9 +807,10 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing;
//@id Unique identifier of the subscription
//@chat_id Identifier of the channel chat that is subscribed
//@expiration_date Point in time (Unix timestamp) when the subscription will expire or expired
//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again
//@is_canceled True, if the subscription was canceled
//@pricing The subscription plan
starSubscription id:string chat_id:int53 expiration_date:int32 is_canceled:Bool pricing:starSubscriptionPricing = StarSubscription;
starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool pricing:starSubscriptionPricing = StarSubscription;
//@description Represents a list of Telegram Star subscriptions
//@star_count The amount of owned Telegram Stars
@ -1262,7 +1263,7 @@ 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
//@can_reuse True, if the user has already paid for the subscription and can use the link to join the subscribed chat again
//@can_reuse True, if the user has already paid for the subscription and can use joinChatByInviteLink to join the subscribed chat again
//@form_id Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid
chatInviteLinkSubscriptionInfo pricing:starSubscriptionPricing can_reuse:Bool form_id:int64 = ChatInviteLinkSubscriptionInfo;

View File

@ -15,6 +15,7 @@ StarSubscription::StarSubscription(telegram_api::object_ptr<telegram_api::starsS
: id_(std::move(subscription->id_))
, dialog_id_(subscription->peer_)
, until_date_(subscription->until_date_)
, can_reuse_(subscription->can_refulfill_)
, is_canceled_(subscription->canceled_)
, pricing_(std::move(subscription->pricing_)) {
}
@ -22,8 +23,8 @@ StarSubscription::StarSubscription(telegram_api::object_ptr<telegram_api::starsS
td_api::object_ptr<td_api::starSubscription> StarSubscription::get_star_subscription_object(Td *td) const {
td->dialog_manager_->force_create_dialog(dialog_id_, "starSubscription", true);
return td_api::make_object<td_api::starSubscription>(
id_, td->dialog_manager_->get_chat_id_object(dialog_id_, "starSubscription"), until_date_, is_canceled_,
pricing_.get_star_subscription_pricing_object());
id_, td->dialog_manager_->get_chat_id_object(dialog_id_, "starSubscription"), until_date_, can_reuse_,
is_canceled_, pricing_.get_star_subscription_pricing_object());
}
StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription) {

View File

@ -22,6 +22,7 @@ class StarSubscription {
string id_;
DialogId dialog_id_;
int32 until_date_ = 0;
bool can_reuse_ = false;
bool is_canceled_ = false;
StarSubscriptionPricing pricing_;