Add "purchased_paid_media" update.

This commit is contained in:
levlam 2024-08-28 13:13:51 +03:00
parent c08e6b3b84
commit cb41fe9930
2 changed files with 32 additions and 0 deletions

View File

@ -3610,6 +3610,23 @@ class Client::JsonPreCheckoutQuery final : public td::Jsonable {
const Client *client_; 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 { class Client::JsonCustomJson final : public td::Jsonable {
public: public:
explicit JsonCustomJson(const td::string &json) : json_(json) { explicit JsonCustomJson(const td::string &json) : json_(json) {
@ -7252,6 +7269,9 @@ void Client::on_update(object_ptr<td_api::Object> result) {
case td_api::updateNewPreCheckoutQuery::ID: case td_api::updateNewPreCheckoutQuery::ID:
add_new_pre_checkout_query(move_object_as<td_api::updateNewPreCheckoutQuery>(result)); add_new_pre_checkout_query(move_object_as<td_api::updateNewPreCheckoutQuery>(result));
break; break;
case td_api::updatePaidMediaPurchased::ID:
add_update_purchased_paid_media(move_object_as<td_api::updatePaidMediaPurchased>(result));
break;
case td_api::updateNewCustomEvent::ID: case td_api::updateNewCustomEvent::ID:
add_new_custom_event(move_object_as<td_api::updateNewCustomEvent>(result)); add_new_custom_event(move_object_as<td_api::updateNewCustomEvent>(result));
break; break;
@ -13349,6 +13369,8 @@ td::Slice Client::get_update_type_name(UpdateType update_type) {
return td::Slice("edited_business_message"); return td::Slice("edited_business_message");
case UpdateType::BusinessMessagesDeleted: case UpdateType::BusinessMessagesDeleted:
return td::Slice("deleted_business_messages"); return td::Slice("deleted_business_messages");
case UpdateType::PurchasedPaidMedia:
return td::Slice("purchased_paid_media");
default: default:
UNREACHABLE(); UNREACHABLE();
return td::Slice(); return td::Slice();
@ -13672,6 +13694,12 @@ void Client::add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQ
query->sender_user_id_ + (static_cast<int64>(4) << 33)); query->sender_user_id_ + (static_cast<int64>(4) << 33));
} }
void Client::add_update_purchased_paid_media(object_ptr<td_api::updatePaidMediaPurchased> &&query) {
CHECK(query != nullptr);
add_update(UpdateType::PurchasedPaidMedia, JsonPaidMediaPurchased(query.get(), this), 86400,
query->user_id_ + (static_cast<int64>(12) << 33));
}
void Client::add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event) { void Client::add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event) {
CHECK(event != nullptr); CHECK(event != nullptr);
add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0); add_update(UpdateType::CustomEvent, JsonCustomJson(event->event_), 600, 0);

View File

@ -148,6 +148,7 @@ class Client final : public WebhookActor::Callback {
class JsonInlineCallbackQuery; class JsonInlineCallbackQuery;
class JsonShippingQuery; class JsonShippingQuery;
class JsonPreCheckoutQuery; class JsonPreCheckoutQuery;
class JsonPaidMediaPurchased;
class JsonBotCommand; class JsonBotCommand;
class JsonBotMenuButton; class JsonBotMenuButton;
class JsonBotName; class JsonBotName;
@ -1108,6 +1109,8 @@ class Client final : public WebhookActor::Callback {
void add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQuery> &&query); void add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQuery> &&query);
void add_update_purchased_paid_media(object_ptr<td_api::updatePaidMediaPurchased> &&query);
void add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event); void add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event);
void add_new_custom_query(object_ptr<td_api::updateNewCustomQuery> &&query); void add_new_custom_query(object_ptr<td_api::updateNewCustomQuery> &&query);
@ -1152,6 +1155,7 @@ class Client final : public WebhookActor::Callback {
BusinessMessage, BusinessMessage,
EditedBusinessMessage, EditedBusinessMessage,
BusinessMessagesDeleted, BusinessMessagesDeleted,
PurchasedPaidMedia,
Size Size
}; };