tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
Message.hpp
Go to the documentation of this file.
1#pragma once
3
4
56
57namespace tgbotxx {
60 struct Chat;
61 struct ChecklistTasksDone;
62 struct ChecklistTasksAdded;
63 struct GiveawayCompleted;
64 struct SuggestedPostApproved;
65 struct SuggestedPostApprovalFailed;
66 struct SuggestedPostDeclined;
67 struct SuggestedPostPaid;
68 struct SuggestedPostRefunded;
69
72 struct Message {
73 Message() = default;
74 explicit Message(const nl::json& json) {
75 fromJson(json);
76 }
77
79 std::int32_t messageId{};
80
82 std::int32_t messageThreadId{};
83
86
90
96
98 std::int32_t senderBoostCount{};
99
102
104 std::time_t date{};
105
110
113
116
119
123
127
130
133
136
139
142
144 std::time_t editDate{};
145
148
151
154
156 std::string mediaGroupId;
157
160 std::string authorSignature;
161
163 std::int64_t paidStarCount{};
164
166 std::string text;
167
169 std::vector<Ptr<MessageEntity>> entities;
170
173
176
178 std::string effectId;
179
183
186
189
191 std::vector<Ptr<PhotoSize>> photo;
192
195
198
201
204
207
209 std::string caption;
210
212 std::vector<Ptr<MessageEntity>> captionEntities;
213
216
219
222
225
228
232
235
239
242
244 std::vector<Ptr<User>> newChatMembers;
245
248
250 std::string newChatTitle;
251
253 std::vector<Ptr<PhotoSize>> newChatPhoto;
254
257
260
265
270
273
278 std::int64_t migrateToChatId{};
279
284 std::int64_t migrateFromChatId{};
285
288
292
296
300
303
306
309
312
315 std::string connectedWebsite;
316
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
408
411 [[nodiscard]] nl::json toJson() const;
412
414 void fromJson(const nl::json& json);
415 };
416}
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
std::variant< Ptr< Message >, Ptr< InaccessibleMessage > > MaybeInaccessibleMessage
This object describes a message that can be inaccessible to the bot. It can be one of.
This object represents a message. https://core.telegram.org/bots/api#message.
Definition Message.hpp:72
std::int64_t migrateToChatId
Optional. The group has been migrated to a supergroup with the specified identifier....
Definition Message.hpp:278
bool channelChatCreated
Optional. Service message: the channel has been created. This field can't be received in a message co...
Definition Message.hpp:269
bool hasMediaSpoiler
Optional. True, if the message media is covered by a spoiler animation.
Definition Message.hpp:218
Ptr< MessageOrigin > forwardOrigin
Optional. Information about the original message for forwarded messages.
Definition Message.hpp:115
std::vector< Ptr< MessageEntity > > entities
Optional. For text messages, special entities like usernames, URLs, bot commands, etc....
Definition Message.hpp:169
Ptr< VideoChatStarted > videoChatStarted
Optional. Service message: video chat started.
Definition Message.hpp:394
Ptr< SuggestedPostApproved > suggestedPostApproved
Optional. Service message: a suggested post was approved.
Definition Message.hpp:376
Ptr< DirectMessagePriceChanged > directMessagePriceChanged
Optional. Service message: the price for paid messages in the corresponding direct messages chat of a...
Definition Message.hpp:340
Ptr< Sticker > sticker
Optional. Message is a sticker, information about the sticker.
Definition Message.hpp:194
std::vector< Ptr< MessageEntity > > captionEntities
Optional. For messages with a caption, special entities like usernames, URLs, bot commands,...
Definition Message.hpp:212
std::string connectedWebsite
Optional. The domain name of the website on which the user has logged in. about Telegram Login » http...
Definition Message.hpp:315
Ptr< ChecklistTasksDone > checklistTasksDone
Optional. Service message: some tasks in a checklist were marked as done or not done.
Definition Message.hpp:334
Ptr< ExternalReplyInfo > externalReply
Optional. Information about the message that is being replied to, which may come from another chat or...
Definition Message.hpp:129
Message(const nl::json &json)
Definition Message.hpp:74
Ptr< SuggestedPostRefunded > suggestedPostRefunded
Optional. Service message: payment for a suggested post was refunded.
Definition Message.hpp:388
std::int32_t messageThreadId
Optional. Unique identifier of a message thread to which the message belongs; for supergroups only.
Definition Message.hpp:82
std::int32_t messageId
Unique message identifier inside this chat.
Definition Message.hpp:79
bool isFromOffline
Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting ...
Definition Message.hpp:150
Ptr< SuggestedPostApprovalFailed > suggestedPostApprovalFailed
Optional. Service message: approval of a suggested post has failed.
Definition Message.hpp:379
Ptr< User > leftChatMember
Optional. A member was removed from the group, information about them (this member may be the bot its...
Definition Message.hpp:247
Message()=default
Ptr< GiftInfo > gift
Optional. Service message: a regular gift was sent or received.
Definition Message.hpp:308
bool isTopicMessage
Optional. True, if the message is sent to a forum topic.
Definition Message.hpp:118
std::vector< Ptr< PhotoSize > > photo
Optional. Message is a photo, available sizes of the photo.
Definition Message.hpp:191
Ptr< Story > story
Optional. Message is a forwarded story.
Definition Message.hpp:197
std::string authorSignature
Optional. Signature of the post author for messages in channels, or the custom title of an anonymous ...
Definition Message.hpp:160
std::string text
Optional. For text messages, the actual UTF-8 text of the message.
Definition Message.hpp:166
Ptr< Animation > animation
Optional. Message is an animation, information about the animation. For backward compatibility,...
Definition Message.hpp:182
Ptr< ForumTopicClosed > forumTopicClosed
Optional. Service message: forum topic closed.
Definition Message.hpp:349
Ptr< User > senderBusinessBot
Optional. The bot that actually sent the message on behalf of the business account....
Definition Message.hpp:101
Ptr< ForumTopicCreated > forumTopicCreated
Optional. Service message: forum topic created.
Definition Message.hpp:343
Ptr< SuccessfulPayment > successfulPayment
Optional. Message is a service message about a successful payment, information about the payment....
Definition Message.hpp:295
Ptr< User > viaBot
Optional. Bot through which the message was sent.
Definition Message.hpp:141
Ptr< Chat > senderChat
Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channe...
Definition Message.hpp:95
std::string mediaGroupId
Optional. The unique identifier of a media message group this message belongs to.
Definition Message.hpp:156
Ptr< VideoChatScheduled > videoChatScheduled
Optional. Service message: video chat scheduled.
Definition Message.hpp:391
std::string newChatTitle
Optional. A chat title was changed to this value.
Definition Message.hpp:250
std::int32_t replyToChecklistTaskId
Optional. Identifier of the specific checklist task that is being replied to.
Definition Message.hpp:138
bool supergroupChatCreated
Optional. Service message: the supergroup has been created. This field can't be received in a message...
Definition Message.hpp:264
Ptr< VideoChatEnded > videoChatEnded
Optional. Service message: video chat ended.
Definition Message.hpp:397
Ptr< GeneralForumTopicHidden > generalForumTopicHidden
Optional. Service message: the 'General' forum topic hidden.
Definition Message.hpp:355
Ptr< GiveawayWinners > giveawayWinners
Optional. A giveaway with public winners was completed.
Definition Message.hpp:367
Ptr< SuggestedPostDeclined > suggestedPostDeclined
Optional. Service message: a suggested post was declined.
Definition Message.hpp:382
std::int32_t senderBoostCount
Optional. If the sender of the message boosted the chat, the number of boosts added by the user.
Definition Message.hpp:98
Ptr< Location > location
Optional. Message is a shared location, information about the location.
Definition Message.hpp:241
Ptr< Document > document
Optional. Message is a general file, information about the file.
Definition Message.hpp:188
Ptr< Invoice > invoice
Optional. Message is an invoice for a payment, information about the invoice. about payments » https:...
Definition Message.hpp:291
Ptr< ChatShared > chatShared
Optional. Service message: a chat was shared with the bot.
Definition Message.hpp:305
Ptr< Video > video
Optional. Message is a video, information about the video.
Definition Message.hpp:200
std::string businessConnectionId
Optional. Unique identifier of the business connection from which the message was received....
Definition Message.hpp:109
Ptr< DirectMessagesTopic > directMessagesTopic
Optional. Information about the direct messages chat topic that contains the message.
Definition Message.hpp:85
Ptr< InlineKeyboardMarkup > replyMarkup
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url ...
Definition Message.hpp:406
std::string caption
Optional. Caption for the animation, audio, document, photo, video or voice.
Definition Message.hpp:209
Ptr< Message > replyToMessage
Optional. For replies, the original message. Note that the Message object in this field will not cont...
Definition Message.hpp:126
Ptr< ForumTopicEdited > forumTopicEdited
Optional. Service message: forum topic edited.
Definition Message.hpp:346
Ptr< ChatBackground > chatBackgroundSet
Optional. Service message: chat background set.
Definition Message.hpp:331
bool showCaptionAboveMedia
Optional. True, if the caption must be shown above the message media.
Definition Message.hpp:215
std::int64_t paidStarCount
Optional. The number of Telegram Stars that were paid by the sender of the message to send it.
Definition Message.hpp:163
Ptr< SuggestedPostInfo > suggestedPostInfo
Optional. Information about suggested post parameters if the message is a suggested post in a channel...
Definition Message.hpp:175
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Ptr< WebAppData > webAppData
Optional. Service message: data sent by a Web App.
Definition Message.hpp:403
bool isPaidPost
Optional. True, if the message is a paid post. Note that such posts must not be deleted for 24 hours ...
Definition Message.hpp:153
std::int64_t migrateFromChatId
Optional. The supergroup has been migrated from a group with the specified identifier....
Definition Message.hpp:284
Ptr< GiveawayCompleted > giveawayCompleted
Optional. Service message: a giveaway without public winners was completed.
Definition Message.hpp:370
bool isAutomaticForward
Optional. True, if the message is a channel post that was automatically forwarded to the connected di...
Definition Message.hpp:122
Ptr< PassportData > passportData
Optional. Telegram Passport data.
Definition Message.hpp:322
Ptr< LinkPreviewOptions > linkPreviewOptions
Optional. Options used for link preview generation for the message, if it is a text message and link ...
Definition Message.hpp:172
std::string effectId
Optional. Unique identifier of the message effect added to the message.
Definition Message.hpp:178
Ptr< Giveaway > giveaway
Optional. The message is a scheduled giveaway message.
Definition Message.hpp:364
Ptr< RefundedPayment > refundedPayment
Optional. Message is a service message about a refunded payment, information about the payment....
Definition Message.hpp:299
Ptr< GiveawayCreated > giveawayCreated
Optional. Service message: a scheduled giveaway was created.
Definition Message.hpp:361
Ptr< Story > replyToStory
Optional. For replies to a story, the original story.
Definition Message.hpp:135
std::time_t editDate
Optional. Date the message was last edited in Unix time.
Definition Message.hpp:144
MaybeInaccessibleMessage pinnedMessage
Optional. Specified message was pinned. Note that the Message object in this field will not contain f...
Definition Message.hpp:287
Ptr< Contact > contact
Optional. Message is a shared contact, information about the contact.
Definition Message.hpp:224
Ptr< ProximityAlertTriggered > proximityAlertTriggered
Optional. Service message. A user in the chat triggered another user's proximity alert while sharing ...
Definition Message.hpp:325
Ptr< Dice > dice
Optional. Message is a dice with random value.
Definition Message.hpp:227
Ptr< ChecklistTasksAdded > checklistTasksAdded
Optional. Service message: tasks were added to a checklist.
Definition Message.hpp:337
Ptr< MessageAutoDeleteTimerChanged > messageAutoDeleteTimerChanged
Optional. Service message: auto-delete timer settings changed in the chat.
Definition Message.hpp:272
Ptr< Voice > voice
Optional. Message is a voice message, information about the file.
Definition Message.hpp:206
Ptr< UsersShared > usersShared
Optional. Service message: users were shared with the bot.
Definition Message.hpp:302
Ptr< ChatBoostAdded > boostAdded
Optional. Service message: user boosted the chat.
Definition Message.hpp:328
bool groupChatCreated
Optional. Service message: the group has been created.
Definition Message.hpp:259
Ptr< SuggestedPostPaid > suggestedPostPaid
Optional. Service message: payment for a suggested post was received.
Definition Message.hpp:385
Ptr< TextQuote > quote
Optional. For replies that quote part of the original message, the quoted part of the message.
Definition Message.hpp:132
Ptr< User > from
Optional. Sender of the message; empty for messages sent to channels. For backward compatibility,...
Definition Message.hpp:89
Ptr< Poll > poll
Optional. Message is a native poll, information about the poll.
Definition Message.hpp:234
Ptr< VideoChatParticipantsInvited > videoChatParticipantsInvited
Optional. Service message: new participants invited to a video chat.
Definition Message.hpp:400
Ptr< WriteAccessAllowed > writeAccessAllowed
Optional. Service message: the user allowed the bot to write messages after adding it to the attachme...
Definition Message.hpp:319
Ptr< UniqueGiftInfo > uniqueGift
Optional. Service message: a unique gift was sent or received.
Definition Message.hpp:311
Ptr< PaidMessagePriceChanged > paidMessagePriceChanged
Optional. Service message: the price for paid messages has changed in the chat.
Definition Message.hpp:373
Ptr< Venue > venue
Optional. Message is a venue, information about the venue. For backward compatibility,...
Definition Message.hpp:238
bool hasProtectedContent
Optional. True, if the message can't be forwarded.
Definition Message.hpp:147
Ptr< Audio > audio
Optional. Message is an audio file, information about the file.
Definition Message.hpp:185
Ptr< VideoNote > videoNote
Optional. Message is a video note, information about the video message.
Definition Message.hpp:203
nl::json toJson() const
Serializes this object to JSON.
bool deleteChatPhoto
Optional. Service message: the chat photo was deleted.
Definition Message.hpp:256
std::vector< Ptr< PhotoSize > > newChatPhoto
Optional. A chat photo was change to this value.
Definition Message.hpp:253
Ptr< Chat > chat
Conversation the message belongs to.
Definition Message.hpp:112
Ptr< ForumTopicReopened > forumTopicReopened
Optional. Service message: forum topic reopened.
Definition Message.hpp:352
Ptr< Game > game
Optional. Message is a game, information about the game. about games » https://core....
Definition Message.hpp:231
std::time_t date
Date the message was sent in Unix time. It is always a positive number, representing a valid date.
Definition Message.hpp:104
Ptr< GeneralForumTopicUnhidden > generalForumTopicUnhidden
Optional. Service message: the 'General' forum topic unhidden.
Definition Message.hpp:358
Ptr< Checklist > checklist
Optional. Message is a checklist.
Definition Message.hpp:221
std::vector< Ptr< User > > newChatMembers
Optional. New members that were added to the group or supergroup and information about them (the bot ...
Definition Message.hpp:244