Add starSubscription.is_expiring.

This commit is contained in:
levlam 2024-08-05 09:28:11 +03:00
parent 191a742fa2
commit a4b557ea05
3 changed files with 7 additions and 3 deletions

View File

@ -809,8 +809,9 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing;
//@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
//@is_expiring True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to prolongate it
//@pricing The subscription plan
starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool pricing:starSubscriptionPricing = StarSubscription;
starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing = StarSubscription;
//@description Represents a list of Telegram Star subscriptions
//@star_count The amount of owned Telegram Stars

View File

@ -17,6 +17,7 @@ StarSubscription::StarSubscription(telegram_api::object_ptr<telegram_api::starsS
, until_date_(subscription->until_date_)
, can_reuse_(subscription->can_refulfill_)
, is_canceled_(subscription->canceled_)
, missing_balance_(subscription->missing_balance_)
, pricing_(std::move(subscription->pricing_)) {
}
@ -24,11 +25,12 @@ td_api::object_ptr<td_api::starSubscription> StarSubscription::get_star_subscrip
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_, can_reuse_,
is_canceled_, pricing_.get_star_subscription_pricing_object());
is_canceled_, missing_balance_, pricing_.get_star_subscription_pricing_object());
}
StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription) {
return string_builder << (subscription.is_canceled_ ? "canceled " : "") << "subscription " << subscription.id_
return string_builder << (subscription.is_canceled_ ? "canceled " : "")
<< (subscription.missing_balance_ ? "expiring " : "") << "subscription " << subscription.id_
<< " to " << subscription.dialog_id_ << " until " << subscription.until_date_ << " for "
<< subscription.pricing_;
}

View File

@ -24,6 +24,7 @@ class StarSubscription {
int32 until_date_ = 0;
bool can_reuse_ = false;
bool is_canceled_ = false;
bool missing_balance_ = false;
StarSubscriptionPricing pricing_;
friend StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription);