Add Message.users_shared field.

This commit is contained in:
levlam 2023-12-22 23:32:52 +03:00 committed by David Guillen Fandos
parent baa0546c31
commit a38d9260af
2 changed files with 19 additions and 1 deletions

View File

@ -2066,6 +2066,20 @@ class Client::JsonUserShared final : public td::Jsonable {
const td_api::messageUsersShared *users_shared_;
};
class Client::JsonUsersShared final : public td::Jsonable {
public:
explicit JsonUsersShared(const td_api::messageUsersShared *users_shared) : users_shared_(users_shared) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("user_ids", td::json_array(users_shared_->user_ids_, [](int64 user_id) { return user_id; }));
object("request_id", users_shared_->button_id_);
}
private:
const td_api::messageUsersShared *users_shared_;
};
class Client::JsonChatShared final : public td::Jsonable {
public:
explicit JsonChatShared(const td_api::messageChatShared *chat_shared) : chat_shared_(chat_shared) {
@ -2880,7 +2894,10 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
}
case td_api::messageUsersShared::ID: {
auto content = static_cast<const td_api::messageUsersShared *>(message_->content.get());
if (content->user_ids_.size() == 1) {
object("user_shared", JsonUserShared(content));
}
object("users_shared", JsonUsersShared(content));
break;
}
case td_api::messageChatShared::ID: {

View File

@ -190,6 +190,7 @@ class Client final : public WebhookActor::Callback {
class JsonChatSetMessageAutoDeleteTime;
class JsonWriteAccessAllowed;
class JsonUserShared;
class JsonUsersShared;
class JsonChatShared;
class JsonGiveaway;
class JsonGiveawayWinners;