Add starSubscription.invite_hash.

This commit is contained in:
levlam 2024-08-09 14:05:09 +03:00
parent fbdec88dd1
commit 9ec8b37493
3 changed files with 9 additions and 4 deletions

View File

@ -810,8 +810,9 @@ starSubscriptionPricing period:int32 star_count:int53 = StarSubscriptionPricing;
//@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 extend it
//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore
//@pricing The subscription plan
starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing = StarSubscription;
starSubscription id:string chat_id:int53 expiration_date:int32 can_reuse:Bool is_canceled:Bool is_expiring:Bool invite_link:string pricing:starSubscriptionPricing = StarSubscription;
//@description Represents a list of Telegram Star subscriptions
//@star_count The amount of owned Telegram Stars

View File

@ -7,6 +7,7 @@
#include "td/telegram/StarSubscription.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/LinkManager.h"
#include "td/telegram/Td.h"
namespace td {
@ -18,6 +19,7 @@ StarSubscription::StarSubscription(telegram_api::object_ptr<telegram_api::starsS
, can_reuse_(subscription->can_refulfill_)
, is_canceled_(subscription->canceled_)
, missing_balance_(subscription->missing_balance_)
, invite_hash_(std::move(subscription->chat_invite_hash_))
, pricing_(std::move(subscription->pricing_)) {
}
@ -25,14 +27,15 @@ 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_, missing_balance_, pricing_.get_star_subscription_pricing_object());
is_canceled_, missing_balance_, LinkManager::get_dialog_invite_link(invite_hash_, false),
pricing_.get_star_subscription_pricing_object());
}
StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription) {
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_;
<< " to " << subscription.dialog_id_ << '/' << subscription.invite_hash_ << " until "
<< subscription.until_date_ << " for " << subscription.pricing_;
}
} // namespace td

View File

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