mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2025-01-01 07:05:49 +01:00
Add class TextQuote.
This commit is contained in:
parent
59436578ee
commit
2c5ff070b3
@ -2192,6 +2192,27 @@ class Client::JsonExternalReplyInfo final : public td::Jsonable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Client::JsonTextQuote final : public td::Jsonable {
|
||||||
|
public:
|
||||||
|
JsonTextQuote(const td_api::textQuote *quote, const Client *client) : quote_(quote), client_(client) {
|
||||||
|
}
|
||||||
|
void store(td::JsonValueScope *scope) const {
|
||||||
|
auto object = scope->enter_object();
|
||||||
|
object("text", quote_->text_->text_);
|
||||||
|
if (!quote_->text_->entities_.empty()) {
|
||||||
|
object("entities", JsonVectorEntities(quote_->text_->entities_, client_));
|
||||||
|
}
|
||||||
|
object("position", quote_->position_);
|
||||||
|
if (quote_->is_manual_) {
|
||||||
|
object("is_manual", td::JsonTrue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const td_api::textQuote *quote_;
|
||||||
|
const Client *client_;
|
||||||
|
};
|
||||||
|
|
||||||
void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
||||||
CHECK(message_ != nullptr);
|
CHECK(message_ != nullptr);
|
||||||
auto object = scope->enter_object();
|
auto object = scope->enter_object();
|
||||||
@ -2272,10 +2293,7 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
|||||||
object("external_reply", JsonExternalReplyInfo(message_->reply_to_message.get(), client_));
|
object("external_reply", JsonExternalReplyInfo(message_->reply_to_message.get(), client_));
|
||||||
}
|
}
|
||||||
if (message_->reply_to_message != nullptr && message_->reply_to_message->quote_ != nullptr) {
|
if (message_->reply_to_message != nullptr && message_->reply_to_message->quote_ != nullptr) {
|
||||||
object("quote", message_->reply_to_message->quote_->text_->text_);
|
object("quote", JsonTextQuote(message_->reply_to_message->quote_.get(), client_));
|
||||||
if (!message_->reply_to_message->quote_->text_->entities_.empty()) {
|
|
||||||
object("quote_entities", JsonVectorEntities(message_->reply_to_message->quote_->text_->entities_, client_));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (message_->media_album_id != 0) {
|
if (message_->media_album_id != 0) {
|
||||||
object("media_group_id", td::to_string(message_->media_album_id));
|
object("media_group_id", td::to_string(message_->media_album_id));
|
||||||
|
@ -99,6 +99,7 @@ class Client final : public WebhookActor::Callback {
|
|||||||
class JsonMessageSender;
|
class JsonMessageSender;
|
||||||
class JsonMessageOrigin;
|
class JsonMessageOrigin;
|
||||||
class JsonExternalReplyInfo;
|
class JsonExternalReplyInfo;
|
||||||
|
class JsonTextQuote;
|
||||||
class JsonLinkPreviewOptions;
|
class JsonLinkPreviewOptions;
|
||||||
class JsonAnimation;
|
class JsonAnimation;
|
||||||
class JsonAudio;
|
class JsonAudio;
|
||||||
|
Loading…
Reference in New Issue
Block a user