Add starRevenueStatus.next_withdrawal_in.

This commit is contained in:
levlam 2024-06-16 21:33:51 +03:00
parent 0fba6aaaf4
commit 315ee9b1d1
2 changed files with 8 additions and 3 deletions

View File

@ -6913,8 +6913,9 @@ chatRevenueTransactions total_count:int32 transactions:vector<chatRevenueTransac
//@total_count Total number of the stars earned
//@current_count The number of Telegram stars that isn't withdrawn yet
//@available_count The number of Telegram stars that are available for withdrawal
//@withdrawal_enabled True, if Telegram stars can be withdrawn
starRevenueStatus total_count:int53 current_count:int53 available_count:int53 withdrawal_enabled:Bool = StarRevenueStatus;
//@withdrawal_enabled True, if Telegram stars can be withdrawn now or later
//@next_withdrawal_in Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now
starRevenueStatus total_count:int53 current_count:int53 available_count:int53 withdrawal_enabled:Bool next_withdrawal_in:int32 = StarRevenueStatus;
//@description A detailed statistics about Telegram stars earned by a bot or a chat
//@revenue_by_day_graph A graph containing amount of revenue in a given day

View File

@ -206,9 +206,13 @@ class RefundStarsChargeQuery final : public Td::ResultHandler {
static td_api::object_ptr<td_api::starRevenueStatus> convert_stars_revenue_status(
telegram_api::object_ptr<telegram_api::starsRevenueStatus> obj) {
CHECK(obj != nullptr);
int32 next_withdrawal_in = 0;
if (obj->withdrawal_enabled_ && obj->next_withdrawal_at_ > 0) {
next_withdrawal_in = max(obj->next_withdrawal_at_ - G()->unix_time(), 1);
}
return td_api::make_object<td_api::starRevenueStatus>(
StarManager::get_star_count(obj->overall_revenue_), StarManager::get_star_count(obj->current_balance_),
StarManager::get_star_count(obj->available_balance_), obj->withdrawal_enabled_);
StarManager::get_star_count(obj->available_balance_), obj->withdrawal_enabled_, next_withdrawal_in);
}
class GetStarsRevenueStatsQuery final : public Td::ResultHandler {