mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-08-27 17:52:21 +02:00
Add message.link_preview_options.
This commit is contained in:
parent
ad84bfc214
commit
c3999a2144
@ -1041,6 +1041,35 @@ class Client::JsonMessages final : public td::Jsonable {
|
||||
const td::vector<td::string> &messages_;
|
||||
};
|
||||
|
||||
class Client::JsonLinkPreviewOptions final : public td::Jsonable {
|
||||
public:
|
||||
JsonLinkPreviewOptions(const td_api::linkPreviewOptions *link_preview_options, const Client *client)
|
||||
: link_preview_options_(link_preview_options), client_(client) {
|
||||
}
|
||||
void store(td::JsonValueScope *scope) const {
|
||||
auto object = scope->enter_object();
|
||||
if (link_preview_options_->is_disabled_) {
|
||||
object("is_disabled", td::JsonTrue());
|
||||
}
|
||||
if (!link_preview_options_->url_.empty()) {
|
||||
object("url", link_preview_options_->url_);
|
||||
}
|
||||
if (link_preview_options_->force_small_media_) {
|
||||
object("prefer_small_media", td::JsonTrue());
|
||||
}
|
||||
if (link_preview_options_->force_large_media_) {
|
||||
object("prefer_large_media", td::JsonTrue());
|
||||
}
|
||||
if (link_preview_options_->show_above_text_) {
|
||||
object("show_above_text", td::JsonTrue());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const td_api::linkPreviewOptions *link_preview_options_;
|
||||
const Client *client_;
|
||||
};
|
||||
|
||||
class Client::JsonAnimation final : public td::Jsonable {
|
||||
public:
|
||||
JsonAnimation(const td_api::animation *animation, bool as_document, const Client *client)
|
||||
@ -2170,6 +2199,9 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
||||
if (!content->text_->entities_.empty()) {
|
||||
object("entities", JsonVectorEntities(content->text_->entities_, client_));
|
||||
}
|
||||
if (content->link_preview_options_ != nullptr) {
|
||||
object("link_preview_options", JsonLinkPreviewOptions(content->link_preview_options_.get(), client_));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case td_api::messageAnimation::ID: {
|
||||
|
@ -110,6 +110,7 @@ class Client final : public WebhookActor::Callback {
|
||||
class JsonChatInviteLink;
|
||||
class JsonChat;
|
||||
class JsonMessageSender;
|
||||
class JsonLinkPreviewOptions;
|
||||
class JsonAnimation;
|
||||
class JsonAudio;
|
||||
class JsonDocument;
|
||||
|
Loading…
Reference in New Issue
Block a user