Support service messages about added boosts.

This commit is contained in:
levlam 2024-02-14 17:44:52 +03:00
parent 5da588afbe
commit 75a2aae6b3
2 changed files with 18 additions and 3 deletions

View File

@ -2092,6 +2092,19 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
const Client *client_; 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 { class Client::JsonWebAppInfo final : public td::Jsonable {
public: public:
explicit JsonWebAppInfo(const td::string &url) : url_(url) { 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_)); object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_));
break; break;
} }
case td_api::messageChatBoost::ID: case td_api::messageChatBoost::ID: {
auto content = static_cast<const td_api::messageChatBoost *>(message_->content.get());
object("boost_added", JsonChatBoostAdded(content));
break; break;
}
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -12347,8 +12363,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messagePremiumGiftCode::ID: case td_api::messagePremiumGiftCode::ID:
return true; return true;
case td_api::messageChatBoost::ID:
return true;
default: default:
break; break;
} }

View File

@ -182,6 +182,7 @@ class Client final : public WebhookActor::Callback {
class JsonGiveaway; class JsonGiveaway;
class JsonGiveawayWinners; class JsonGiveawayWinners;
class JsonGiveawayCompleted; class JsonGiveawayCompleted;
class JsonChatBoostAdded;
class JsonUpdateTypes; class JsonUpdateTypes;
class JsonWebhookInfo; class JsonWebhookInfo;
class JsonStickerSet; class JsonStickerSet;