diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 676011d..9542b2d 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -3610,6 +3610,23 @@ class Client::JsonPreCheckoutQuery final : public td::Jsonable { const Client *client_; }; +class Client::JsonPaidMediaPurchased final : public td::Jsonable { + public: + JsonPaidMediaPurchased(const td_api::updatePaidMediaPurchased *update, const Client *client) + : update_(update), client_(client) { + } + + void store(td::JsonValueScope *scope) const { + auto object = scope->enter_object(); + object("from", JsonUser(update_->user_id_, client_)); + object("payload", update_->payload_); + } + + private: + const td_api::updatePaidMediaPurchased *update_; + const Client *client_; +}; + class Client::JsonCustomJson final : public td::Jsonable { public: explicit JsonCustomJson(const td::string &json) : json_(json) { @@ -7252,6 +7269,9 @@ void Client::on_update(object_ptr result) { case td_api::updateNewPreCheckoutQuery::ID: add_new_pre_checkout_query(move_object_as(result)); break; + case td_api::updatePaidMediaPurchased::ID: + add_update_purchased_paid_media(move_object_as(result)); + break; case td_api::updateNewCustomEvent::ID: add_new_custom_event(move_object_as(result)); break; @@ -13349,6 +13369,8 @@ td::Slice Client::get_update_type_name(UpdateType update_type) { return td::Slice("edited_business_message"); case UpdateType::BusinessMessagesDeleted: return td::Slice("deleted_business_messages"); + case UpdateType::PurchasedPaidMedia: + return td::Slice("purchased_paid_media"); default: UNREACHABLE(); return td::Slice(); @@ -13672,6 +13694,12 @@ void Client::add_new_pre_checkout_query(object_ptrsender_user_id_ + (static_cast(4) << 33)); } +void Client::add_update_purchased_paid_media(object_ptr &&query) { + CHECK(query != nullptr); + add_update(UpdateType::PurchasedPaidMedia, JsonPaidMediaPurchased(query.get(), this), 86400, + query->user_id_ + (static_cast(12) << 33)); +} + void Client::add_new_custom_event(object_ptr &&event) { CHECK(event != nullptr); add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index dba71ac..24176c4 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -148,6 +148,7 @@ class Client final : public WebhookActor::Callback { class JsonInlineCallbackQuery; class JsonShippingQuery; class JsonPreCheckoutQuery; + class JsonPaidMediaPurchased; class JsonBotCommand; class JsonBotMenuButton; class JsonBotName; @@ -1108,6 +1109,8 @@ class Client final : public WebhookActor::Callback { void add_new_pre_checkout_query(object_ptr &&query); + void add_update_purchased_paid_media(object_ptr &&query); + void add_new_custom_event(object_ptr &&event); void add_new_custom_query(object_ptr &&query); @@ -1152,6 +1155,7 @@ class Client final : public WebhookActor::Callback { BusinessMessage, EditedBusinessMessage, BusinessMessagesDeleted, + PurchasedPaidMedia, Size };