From ee59941ca3127d557df6279a06fbf566b59ea5e0 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 22 Dec 2023 23:32:52 +0300 Subject: [PATCH] Add Message.users_shared field. --- telegram-bot-api/Client.cpp | 19 ++++++++++++++++++- telegram-bot-api/Client.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index a76b0a4..8d18b59 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -1964,6 +1964,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) { @@ -2762,7 +2776,10 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const { } case td_api::messageUsersShared::ID: { auto content = static_cast(message_->content.get()); - object("user_shared", JsonUserShared(content)); + if (content->user_ids_.size() == 1) { + object("user_shared", JsonUserShared(content)); + } + object("users_shared", JsonUsersShared(content)); break; } case td_api::messageChatShared::ID: { diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 4169810..0a125ca 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -177,6 +177,7 @@ class Client final : public WebhookActor::Callback { class JsonChatSetMessageAutoDeleteTime; class JsonWriteAccessAllowed; class JsonUserShared; + class JsonUsersShared; class JsonChatShared; class JsonGiveaway; class JsonGiveawayWinners;