tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ExternalReplyInfo.hpp
Go to the documentation of this file.
1#pragma once
26
27namespace tgbotxx {
31 ExternalReplyInfo() = default;
32 explicit ExternalReplyInfo(const nl::json& json) {
33 fromJson(json);
34 }
35
38
41
43 std::int32_t messageId{};
44
47
50
53
56
59
61 std::vector<Ptr<PhotoSize>> photo;
62
65
68
71
74
77
80
83
86
89
93
96
99
103
106
109
112
115 nl::json toJson() const {
116 nl::json json = nl::json::object();
117 OBJECT_SERIALIZE_FIELD_PTR(json, "origin", origin);
118 OBJECT_SERIALIZE_FIELD_PTR(json, "chat", chat);
119 OBJECT_SERIALIZE_FIELD(json, "message_id", messageId);
120 OBJECT_SERIALIZE_FIELD_PTR(json, "link_preview_options", linkPreviewOptions);
121 OBJECT_SERIALIZE_FIELD_PTR(json, "animation", animation);
122 OBJECT_SERIALIZE_FIELD_PTR(json, "audio", audio);
123 OBJECT_SERIALIZE_FIELD_PTR(json, "document", document);
124 OBJECT_SERIALIZE_FIELD_PTR(json, "paid_media", paidMedia);
126 OBJECT_SERIALIZE_FIELD_PTR(json, "sticker", sticker);
127 OBJECT_SERIALIZE_FIELD_PTR(json, "story", story);
128 OBJECT_SERIALIZE_FIELD_PTR(json, "video", video);
129 OBJECT_SERIALIZE_FIELD_PTR(json, "video_note", videoNote);
130 OBJECT_SERIALIZE_FIELD_PTR(json, "voice", voice);
131 OBJECT_SERIALIZE_FIELD(json, "has_media_spoiler", hasMediaSpoiler);
132 OBJECT_SERIALIZE_FIELD_PTR(json, "checklist", checklist);
133 OBJECT_SERIALIZE_FIELD_PTR(json, "contact", contact);
134 OBJECT_SERIALIZE_FIELD_PTR(json, "dice", dice);
135 OBJECT_SERIALIZE_FIELD_PTR(json, "game", game);
136 OBJECT_SERIALIZE_FIELD_PTR(json, "giveaway", giveaway);
137 OBJECT_SERIALIZE_FIELD_PTR(json, "giveaway_winners", giveawayWinners);
138 OBJECT_SERIALIZE_FIELD_PTR(json, "invoice", invoice);
139 OBJECT_SERIALIZE_FIELD_PTR(json, "location", location);
140 OBJECT_SERIALIZE_FIELD_PTR(json, "poll", poll);
141 OBJECT_SERIALIZE_FIELD_PTR(json, "venue", venue);
142 return json;
143 }
144
146 void fromJson(const nl::json& json) {
147 OBJECT_DESERIALIZE_FIELD_PTR(json, "origin", origin, false);
148 OBJECT_DESERIALIZE_FIELD_PTR(json, "chat", chat, true);
149 OBJECT_DESERIALIZE_FIELD(json, "message_id", messageId, 0, true);
150 OBJECT_DESERIALIZE_FIELD_PTR(json, "link_preview_options", linkPreviewOptions, true);
151 OBJECT_DESERIALIZE_FIELD_PTR(json, "animation", animation, true);
152 OBJECT_DESERIALIZE_FIELD_PTR(json, "audio", audio, true);
153 OBJECT_DESERIALIZE_FIELD_PTR(json, "document", document, true);
154 OBJECT_DESERIALIZE_FIELD_PTR(json, "paid_media", paidMedia, true);
155 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "photo", photo, true);
156 OBJECT_DESERIALIZE_FIELD_PTR(json, "sticker", sticker, true);
157 OBJECT_DESERIALIZE_FIELD_PTR(json, "story", story, true);
158 OBJECT_DESERIALIZE_FIELD_PTR(json, "video", video, true);
159 OBJECT_DESERIALIZE_FIELD_PTR(json, "video_note", videoNote, true);
160 OBJECT_DESERIALIZE_FIELD_PTR(json, "voice", voice, true);
161 OBJECT_DESERIALIZE_FIELD(json, "has_media_spoiler", hasMediaSpoiler, false, true);
162 OBJECT_DESERIALIZE_FIELD_PTR(json, "checklist", checklist, true);
163 OBJECT_DESERIALIZE_FIELD_PTR(json, "contact", contact, true);
164 OBJECT_DESERIALIZE_FIELD_PTR(json, "dice", dice, true);
165 OBJECT_DESERIALIZE_FIELD_PTR(json, "game", game, true);
166 OBJECT_DESERIALIZE_FIELD_PTR(json, "giveaway_winners", giveawayWinners, true);
167 OBJECT_DESERIALIZE_FIELD_PTR(json, "invoice", invoice, true);
168 OBJECT_DESERIALIZE_FIELD_PTR(json, "location", location, true);
169 OBJECT_DESERIALIZE_FIELD_PTR(json, "poll", poll, true);
170 OBJECT_DESERIALIZE_FIELD_PTR(json, "venue", venue, true);
171 }
172 };
173}
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition Object.hpp:22
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition Object.hpp:72
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:46
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:89
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object contains information about a message that is being replied to, which may come from anothe...
Ptr< Game > game
Optional. Message is a game, information about the game. about games » https://core....
Ptr< VideoNote > videoNote
Optional. Message is a video note, information about the video message.
Ptr< MessageOrigin > origin
Origin of the message replied to by the given message.
Ptr< Sticker > sticker
Optional. Message is a sticker, information about the sticker.
Ptr< Animation > animation
Optional. Message is an animation, information about the animation.
Ptr< Checklist > checklist
Optional. Message is a checklist.
Ptr< Story > story
Optional. Message is a forwarded story.
Ptr< Giveaway > giveaway
Optional. Message is a scheduled giveaway, information about the giveaway.
std::int32_t messageId
Optional. Unique message identifier inside the original chat. Available only if the original chat is ...
Ptr< Voice > voice
Optional. Message is a voice message, information about the file.
bool hasMediaSpoiler
Optional. True, if the message media is covered by a spoiler animation.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Ptr< Contact > contact
Optional. Message is a shared contact, information about the contact.
Ptr< Venue > venue
Optional. Message is a venue, information about the venue.
Ptr< PaidMediaInfo > paidMedia
Optional. Message contains paid media; information about the paid media.
std::vector< Ptr< PhotoSize > > photo
Optional. Message is a photo, available sizes of the photo.
Ptr< Location > location
Optional. Message is a shared location, information about the location.
Ptr< Poll > poll
Optional. Message is a native poll, information about the poll.
Ptr< Invoice > invoice
Optional. Message is an invoice for a payment, information about the invoice. about payments » https:...
Ptr< Document > document
Optional. Message is a general file, information about the file.
Ptr< LinkPreviewOptions > linkPreviewOptions
Optional. Options used for link preview generation for the original message, if it is a text message.
ExternalReplyInfo(const nl::json &json)
Ptr< GiveawayWinners > giveawayWinners
Optional. A giveaway with public winners was completed.
nl::json toJson() const
Serializes this object to JSON.
Ptr< Chat > chat
Optional. Chat the original message belongs to. Available only if the chat is a supergroup or a chann...
Ptr< Audio > audio
Optional. Message is an audio file, information about the file.
Ptr< Dice > dice
Optional. Message is a dice with random value.
Ptr< Video > video
Optional. Message is a video, information about the video.