Add td_api::updateChatRevenueAmount.

This commit is contained in:
levlam 2024-04-26 01:15:24 +03:00
parent 0b6cd420d5
commit 1aa1c40eab
5 changed files with 19 additions and 7 deletions

View File

@ -7227,6 +7227,9 @@ updateDefaultReactionType reaction_type:ReactionType = Update;
//@tags The new tags
updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = 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
updateChatRevenueAmount = Update;
//@description The parameters of speech recognition without Telegram Premium subscription has changed
//@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds
//@weekly_count The total number of allowed speech recognitions per week; 0 if none

View File

@ -697,6 +697,11 @@ void StatisticsManager::get_channel_revenue_statistics(
td_->create_handler<GetBroadcastRevenueStatsQuery>(std::move(promise))->send(dialog_id.get_channel_id(), is_dark);
}
void StatisticsManager::on_update_dialog_revenue_transactions(
telegram_api::object_ptr<telegram_api::broadcastRevenueBalances> balances) {
send_closure(G()->td(), &Td::send_update, td_api::make_object<td_api::updateChatRevenueAmount>());
}
void StatisticsManager::get_channel_revenue_withdrawal_url(DialogId dialog_id, const string &password,
Promise<string> &&promise) {
TRY_STATUS_PROMISE(promise, td_->dialog_manager_->check_dialog_access(dialog_id, false, AccessRights::Write,

View File

@ -38,6 +38,8 @@ class StatisticsManager final : public Actor {
void get_channel_revenue_transactions(DialogId dialog_id, int32 offset, int32 limit,
Promise<td_api::object_ptr<td_api::chatRevenueTransactions>> &&promise);
void on_update_dialog_revenue_transactions(telegram_api::object_ptr<telegram_api::broadcastRevenueBalances> balances);
void get_channel_message_statistics(MessageFullId message_full_id, bool is_dark,
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);

View File

@ -67,6 +67,7 @@
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/SpecialStickerSetType.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/StatisticsManager.h"
#include "td/telegram/StickerListType.h"
#include "td/telegram/StickerSetId.h"
#include "td/telegram/StickersManager.h"
@ -4549,15 +4550,16 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotDeleteBusine
add_pending_qts_update(std::move(update), qts, std::move(promise));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBroadcastRevenueTransactions> update,
Promise<Unit> &&promise) {
td_->statistics_manager_->on_update_dialog_revenue_transactions(std::move(update->balances_));
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::updateBroadcastRevenueTransactions> update,
Promise<Unit> &&promise) {
promise.set_value(Unit());
}
} // namespace td

View File

@ -669,11 +669,11 @@ class UpdatesManager final : public Actor {
void on_update(tl_object_ptr<telegram_api::updateBotDeleteBusinessMessage> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateBroadcastRevenueTransactions> 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::updateBroadcastRevenueTransactions> update, Promise<Unit> &&promise);
};
} // namespace td