From 75a2aae6b361b67e016645fa5debcb9e8b2ff7b6 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 14 Feb 2024 17:44:52 +0300 Subject: [PATCH] Support service messages about added boosts. --- telegram-bot-api/Client.cpp | 20 +++++++++++++++++--- telegram-bot-api/Client.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 413a3c1..02b65fa 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -2092,6 +2092,19 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable { const Client *client_; }; +class Client::JsonChatBoostAdded final : public td::Jsonable { + public: + JsonChatBoostAdded(const td_api::messageChatBoost *chat_boost) : chat_boost_(chat_boost) { + } + void store(td::JsonValueScope *scope) const { + auto object = scope->enter_object(); + object("boost_count", chat_boost_->boost_count_); + } + + private: + const td_api::messageChatBoost *chat_boost_; +}; + class Client::JsonWebAppInfo final : public td::Jsonable { public: explicit JsonWebAppInfo(const td::string &url) : url_(url) { @@ -2816,8 +2829,11 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const { object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_)); break; } - case td_api::messageChatBoost::ID: + case td_api::messageChatBoost::ID: { + auto content = static_cast(message_->content.get()); + object("boost_added", JsonChatBoostAdded(content)); break; + } default: UNREACHABLE(); } @@ -12347,8 +12363,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr