Add GiveawayCreated.prize_star_count.

This commit is contained in:
levlam 2024-08-28 12:27:23 +03:00
parent 3fdee61a88
commit 7422214945
2 changed files with 21 additions and 2 deletions

View File

@ -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<const td_api::messageGiveawayCreated *>(message_->content.get());
object("giveaway_created", JsonGiveawayCreated(content));
break;
}
case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messageGiveaway *>(message_->content.get());
object("giveaway", JsonGiveaway(content, client_));

View File

@ -194,6 +194,7 @@ class Client final : public WebhookActor::Callback {
class JsonSharedUser;
class JsonUsersShared;
class JsonChatShared;
class JsonGiveawayCreated;
class JsonGiveaway;
class JsonGiveawayWinners;
class JsonGiveawayCompleted;