From e5af2d3133d8af12fefd555c02ec73fe0c0e9b67 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 29 Dec 2022 16:56:32 +0300 Subject: [PATCH] Add Message.has_media_spoiler field. --- telegram-bot-api/Client.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index c01be64..398a49d 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -653,6 +653,12 @@ class Client::JsonMessage final : public Jsonable { } } } + + void add_media_spoiler(td::JsonObjectScope &object, bool has_spoiler) const { + if (has_spoiler) { + object("has_media_spoiler", td::JsonTrue()); + } + } }; class Client::JsonChat final : public Jsonable { @@ -1876,6 +1882,7 @@ void Client::JsonMessage::store(JsonValueScope *scope) const { object("animation", JsonAnimation(content->animation_.get(), false, client_)); object("document", JsonAnimation(content->animation_.get(), true, client_)); add_caption(object, content->caption_); + add_media_spoiler(object, content->has_spoiler_); break; } case td_api::messageAudio::ID: { @@ -1895,6 +1902,7 @@ void Client::JsonMessage::store(JsonValueScope *scope) const { CHECK(content->photo_ != nullptr); object("photo", JsonPhoto(content->photo_.get(), client_)); add_caption(object, content->caption_); + add_media_spoiler(object, content->has_spoiler_); break; } case td_api::messageSticker::ID: { @@ -1906,6 +1914,7 @@ void Client::JsonMessage::store(JsonValueScope *scope) const { auto content = static_cast(message_->content.get()); object("video", JsonVideo(content->video_.get(), client_)); add_caption(object, content->caption_); + add_media_spoiler(object, content->has_spoiler_); break; } case td_api::messageVideoNote::ID: {