diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 3db925d..468af8d 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -2419,6 +2419,22 @@ class Client::JsonChatShared final : public td::Jsonable { const Client *client_; }; +class Client::JsonGiveawayCreated final : public td::Jsonable { + public: + explicit JsonGiveawayCreated(const td_api::messageGiveawayCreated *giveaway_created) + : giveaway_created_(giveaway_created) { + } + void store(td::JsonValueScope *scope) const { + auto object = scope->enter_object(); + if (giveaway_created_->star_count_ > 0) { + object("prize_star_count", giveaway_created_->star_count_); + } + } + + private: + const td_api::messageGiveawayCreated *giveaway_created_; +}; + class Client::JsonGiveaway final : public td::Jsonable { public: JsonGiveaway(const td_api::messageGiveaway *giveaway, const Client *client) : giveaway_(giveaway), client_(client) { @@ -3290,9 +3306,11 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const { } case td_api::messagePremiumGiftCode::ID: break; - case td_api::messageGiveawayCreated::ID: - object("giveaway_created", JsonEmptyObject()); + case td_api::messageGiveawayCreated::ID: { + auto content = static_cast(message_->content.get()); + object("giveaway_created", JsonGiveawayCreated(content)); break; + } case td_api::messageGiveaway::ID: { auto content = static_cast(message_->content.get()); object("giveaway", JsonGiveaway(content, client_)); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 820398b..dba71ac 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -194,6 +194,7 @@ class Client final : public WebhookActor::Callback { class JsonSharedUser; class JsonUsersShared; class JsonChatShared; + class JsonGiveawayCreated; class JsonGiveaway; class JsonGiveawayWinners; class JsonGiveawayCompleted;