Add chatBoostStatus.gift_code_boost_count.

This commit is contained in:
levlam 2023-10-20 23:18:16 +03:00
parent cfb802eb9d
commit 00ac941e64
2 changed files with 7 additions and 3 deletions

View File

@ -3514,13 +3514,14 @@ prepaidPremiumGiveaway id:int64 user_count:int32 month_count:int32 payment_date:
//@boost_url An HTTP URL, which can be used to boost the chat
//@applied_slots Identifiers of boost slots of the current user applied to the chat
//@level Current boost level of the chat
//@boost_count The number of times the chat was boosted
//@gift_code_boost_count The number of boosts received by the chat from created Telegram Premium gift codes and giveaways
//@boost_count The number of boosts received by the chat
//@current_level_boost_count The number of boosts added to reach the current level
//@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available
//@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat
//@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat
//@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators
chatBoostStatus boost_url:string applied_slots:vector<int32> level:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector<prepaidPremiumGiveaway> = ChatBoostStatus;
chatBoostStatus boost_url:string applied_slots:vector<int32> level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector<prepaidPremiumGiveaway> = ChatBoostStatus;
//@description Describes a boost of a chat
//@count The number of boosts applied

View File

@ -14,6 +14,7 @@
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/misc.h"
#include "td/utils/SliceBuilder.h"
namespace td {
@ -76,8 +77,10 @@ class GetBoostsStatusQuery final : public Td::ResultHandler {
return td_api::make_object<td_api::prepaidPremiumGiveaway>(
giveaway->id_, giveaway->quantity_, giveaway->months_, giveaway->date_);
});
auto boost_count = max(0, result->boosts_);
auto gift_code_boost_count = clamp(result->gift_boosts_, 0, boost_count);
promise_.set_value(td_api::make_object<td_api::chatBoostStatus>(
result->boost_url_, std::move(result->my_boost_slots_), result->level_, result->boosts_,
result->boost_url_, std::move(result->my_boost_slots_), result->level_, gift_code_boost_count, boost_count,
result->current_level_boosts_, result->next_level_boosts_, premium_member_count, premium_member_percentage,
std::move(giveaways)));
}