mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-12-26 12:45:52 +01:00
Add Message.giveaway_completed.
This commit is contained in:
parent
253d3acddc
commit
e6e6cbc72f
@ -998,6 +998,24 @@ class Client::JsonChat final : public td::Jsonable {
|
||||
int32 distance_;
|
||||
};
|
||||
|
||||
class Client::JsonDeletedMessage final : public td::Jsonable {
|
||||
public:
|
||||
JsonDeletedMessage(int64 chat_id, int64 message_id, const Client *client)
|
||||
: chat_id_(chat_id), message_id_(message_id), client_(client) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
object("message_id", as_client_message_id(message_id_));
|
||||
object("chat", JsonChat(chat_id_, client_));
|
||||
object("date", 0);
|
||||
}
|
||||
|
||||
private:
|
||||
int64 chat_id_;
|
||||
int64 message_id_;
|
||||
const Client *client_;
|
||||
};
|
||||
|
||||
class Client::JsonMessageSender final : public td::Jsonable {
|
||||
public:
|
||||
JsonMessageSender(const td_api::MessageSender *sender_id, const Client *client)
|
||||
@ -2039,6 +2057,31 @@ class Client::JsonGiveaway final : public td::Jsonable {
|
||||
const Client *client_;
|
||||
};
|
||||
|
||||
class Client::JsonGiveawayCompleted final : public td::Jsonable {
|
||||
public:
|
||||
JsonGiveawayCompleted(const td_api::messagePremiumGiveawayCompleted *giveaway_completed, int64 chat_id,
|
||||
const Client *client)
|
||||
: giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
object("winner_count", giveaway_completed_->winner_count_);
|
||||
if (giveaway_completed_->unclaimed_prize_count_ > 0) {
|
||||
object("unclaimed_prize_count", giveaway_completed_->unclaimed_prize_count_);
|
||||
}
|
||||
const MessageInfo *giveaway_message =
|
||||
client_->get_message(chat_id_, giveaway_completed_->giveaway_message_id_, true);
|
||||
if (giveaway_message != nullptr) {
|
||||
object("giveaway_message", JsonMessage(giveaway_message, true, "giveaway completed", client_));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const td_api::messagePremiumGiveawayCompleted *giveaway_completed_;
|
||||
int64 chat_id_;
|
||||
const Client *client_;
|
||||
};
|
||||
|
||||
class Client::JsonWebAppInfo final : public td::Jsonable {
|
||||
public:
|
||||
explicit JsonWebAppInfo(const td::string &url) : url_(url) {
|
||||
@ -2756,8 +2799,11 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
||||
object("giveaway", JsonGiveaway(content, client_));
|
||||
break;
|
||||
}
|
||||
case td_api::messagePremiumGiveawayCompleted::ID:
|
||||
case td_api::messagePremiumGiveawayCompleted::ID: {
|
||||
auto content = static_cast<const td_api::messagePremiumGiveawayCompleted *>(message_->content.get());
|
||||
object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2775,24 +2821,6 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
||||
}
|
||||
}
|
||||
|
||||
class Client::JsonDeletedMessage final : public td::Jsonable {
|
||||
public:
|
||||
JsonDeletedMessage(int64 chat_id, int64 message_id, const Client *client)
|
||||
: chat_id_(chat_id), message_id_(message_id), client_(client) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
object("message_id", as_client_message_id(message_id_));
|
||||
object("chat", JsonChat(chat_id_, client_));
|
||||
object("date", 0);
|
||||
}
|
||||
|
||||
private:
|
||||
int64 chat_id_;
|
||||
int64 message_id_;
|
||||
const Client *client_;
|
||||
};
|
||||
|
||||
class Client::JsonMessageId final : public td::Jsonable {
|
||||
public:
|
||||
explicit JsonMessageId(int64 message_id) : message_id_(message_id) {
|
||||
@ -13047,6 +13075,7 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
|
||||
case td_api::messageForumTopicIsHiddenToggled::ID:
|
||||
case td_api::messagePremiumGiveawayCreated::ID:
|
||||
case td_api::messagePremiumGiveaway::ID:
|
||||
case td_api::messagePremiumGiveawayCompleted::ID:
|
||||
// don't skip
|
||||
break;
|
||||
default:
|
||||
@ -13157,8 +13186,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
|
||||
return true;
|
||||
case td_api::messagePremiumGiftCode::ID:
|
||||
return true;
|
||||
case td_api::messagePremiumGiveawayCompleted::ID:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ class Client final : public WebhookActor::Callback {
|
||||
class JsonUserShared;
|
||||
class JsonChatShared;
|
||||
class JsonGiveaway;
|
||||
class JsonGiveawayCompleted;
|
||||
class JsonUpdateTypes;
|
||||
class JsonWebhookInfo;
|
||||
class JsonStickerSet;
|
||||
|
Loading…
Reference in New Issue
Block a user