Add payment_link to premiumFeatures.

This commit is contained in:
levlam 2022-05-24 16:30:01 +03:00
parent 38be1031bc
commit e2ce1a64c7
2 changed files with 15 additions and 2 deletions

View File

@ -2944,7 +2944,8 @@ premiumFeatureAnimatedProfilePhoto = PremiumFeature;
premiumLimit type:PremiumLimitType default_value:int32 premium_value:int32 = PremiumLimit;
//@description Contains information about features, available to Premium users @features The list of available features @limits The list of limits, increased for Premium users
premiumFeatures features:vector<PremiumFeature> limits:vector<premiumLimit> = PremiumFeatures;
//@payment_link An internal link to be opened to pay for Telegram Premium if store payment isn't possible; may be null if direct payment isn't available. If the link has type internalLinkTypeBotStart, then sendBotStartMessage must be called automatically
premiumFeatures features:vector<PremiumFeature> limits:vector<premiumLimit> payment_link:InternalLinkType = PremiumFeatures;
//@class PremiumSource @description Describes a source, from which the Premium features screen is opened

View File

@ -240,7 +240,19 @@ void get_premium_features(Td *td, const td_api::object_ptr<td_api::PremiumSource
Promise<Unit>());
}
promise.set_value(td_api::make_object<td_api::premiumFeatures>(std::move(features), std::move(limits)));
td_api::object_ptr<td_api::InternalLinkType> payment_link;
auto premium_bot_username = G()->shared_config().get_option_string("premium_bot_username");
if (!premium_bot_username.empty()) {
payment_link = td_api::make_object<td_api::internalLinkTypeBotStart>(premium_bot_username, source_str);
} else {
auto premium_invoice_slug = G()->shared_config().get_option_string("premium_invoice_slug");
if (!premium_invoice_slug.empty()) {
payment_link = td_api::make_object<td_api::internalLinkTypeInvoice>(premium_invoice_slug);
}
}
promise.set_value(
td_api::make_object<td_api::premiumFeatures>(std::move(features), std::move(limits), std::move(payment_link)));
}
} // namespace td