Add td_api::updateOwnedStarCount.

This commit is contained in:
levlam 2024-05-16 13:41:04 +03:00
parent be4543f77c
commit 7ab4d9b87b
3 changed files with 14 additions and 6 deletions

View File

@ -7286,6 +7286,9 @@ updateDefaultReactionType reaction_type:ReactionType = Update;
//@tags The new tags
updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update;
//@description The number of stars owned by the current user has changed @star_count The new number of stars owned
updateOwnedStarCount star_count:int53 = Update;
//@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions
//@chat_id Identifier of the chat
//@revenue_amount New amount of earned revenue

View File

@ -4560,14 +4560,19 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBroadcastRevenu
promise.set_value(Unit());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStarsBalance> update, Promise<Unit> &&promise) {
if (update->balance_ < 0) {
LOG(ERROR) << "Receive " << update->balance_ << " stars";
update->balance_ = 0;
}
send_closure(G()->td(), &Td::send_update, td_api::make_object<td_api::updateOwnedStarCount>(update->balance_));
promise.set_value(Unit());
}
// unsupported updates
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateNewStoryReaction> update, Promise<Unit> &&promise) {
promise.set_value(Unit());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStarsBalance> update, Promise<Unit> &&promise) {
promise.set_value(Unit());
}
} // namespace td

View File

@ -671,11 +671,11 @@ class UpdatesManager final : public Actor {
void on_update(tl_object_ptr<telegram_api::updateBroadcastRevenueTransactions> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateStarsBalance> update, Promise<Unit> &&promise);
// unsupported updates
void on_update(tl_object_ptr<telegram_api::updateNewStoryReaction> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateStarsBalance> update, Promise<Unit> &&promise);
};
} // namespace td