tgbotxx 1.2.9.5
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 struct ChatOwnerLeft;
70 struct ChatOwnerChanged;
71
74 struct Message {
75 Message() = default;
76 explicit Message(const nl::json& json) {
78 }
79
81 std::int32_t messageId{};
82
84 std::int32_t messageThreadId{};
85
88
92
98
100 std::int32_t senderBoostCount{};
101
104
106 std::string senderTag;
107
109 std::time_t date{};
110
115
118
121
124
128
132
135
138
141
144
147
149 std::time_t editDate{};
150
153
156
159
161 std::string mediaGroupId;
162
165 std::string authorSignature;
166
168 std::int64_t paidStarCount{};
169
171 std::string text;
172
174 std::vector<Ptr<MessageEntity>> entities;
175
178
181
183 std::string effectId;
184
188
191
194
196 std::vector<Ptr<PhotoSize>> photo;
197
200
203
206
209
212
214 std::string caption;
215
217 std::vector<Ptr<MessageEntity>> captionEntities;
218
221
224
227
230
233
237
240
244
247
249 std::vector<Ptr<User>> newChatMembers;
250
253
256
259
261 std::string newChatTitle;
262
264 std::vector<Ptr<PhotoSize>> newChatPhoto;
265
268
271
276
281
284
289 std::int64_t migrateToChatId{};
290
295 std::int64_t migrateFromChatId{};
296
299
303
307
311
314
317
320
323
326
329 std::string connectedWebsite;
330
334
337
340
343
346
349
352
355
358
361
364
367
370
373
376
379
382
385
388
391
394
397
400
403
406
409
412
415
418
421
422
425 [[nodiscard]] nl::json toJson() const;
426
428 void fromJson(const nl::json& json);
429 };
430}
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:74
std::int64_t migrateToChatId
Optional. The group has been migrated to a supergroup with the specified identifier....
Definition Message.hpp:289
bool channelChatCreated
Optional. Service message: the channel has been created. This field can't be received in a message co...
Definition Message.hpp:280
bool hasMediaSpoiler
Optional. True, if the message media is covered by a spoiler animation.
Definition Message.hpp:223
Ptr< MessageOrigin > forwardOrigin
Optional. Information about the original message for forwarded messages.
Definition Message.hpp:120
std::vector< Ptr< MessageEntity > > entities
Optional. For text messages, special entities like usernames, URLs, bot commands, etc....
Definition Message.hpp:174
Ptr< VideoChatStarted > videoChatStarted
Optional. Service message: video chat started.
Definition Message.hpp:408
Ptr< SuggestedPostApproved > suggestedPostApproved
Optional. Service message: a suggested post was approved.
Definition Message.hpp:390
Ptr< DirectMessagePriceChanged > directMessagePriceChanged
Optional. Service message: the price for paid messages in the corresponding direct messages chat of a...
Definition Message.hpp:354
Ptr< ChatOwnerLeft > chatOwnerLeft
Optional. Service message: chat owner has left.
Definition Message.hpp:255
Ptr< Sticker > sticker
Optional. Message is a sticker, information about the sticker.
Definition Message.hpp:199
std::vector< Ptr< MessageEntity > > captionEntities
Optional. For messages with a caption, special entities like usernames, URLs, bot commands,...
Definition Message.hpp:217
std::string connectedWebsite
Optional. The domain name of the website on which the user has logged in. about Telegram Login » http...
Definition Message.hpp:329
Ptr< ChecklistTasksDone > checklistTasksDone
Optional. Service message: some tasks in a checklist were marked as done or not done.
Definition Message.hpp:348
Ptr< ExternalReplyInfo > externalReply
Optional. Information about the message that is being replied to, which may come from another chat or...
Definition Message.hpp:134
Message(const nl::json &json)
Definition Message.hpp:76
Ptr< SuggestedPostRefunded > suggestedPostRefunded
Optional. Service message: payment for a suggested post was refunded.
Definition Message.hpp:402
std::int32_t messageThreadId
Optional. Unique identifier of a message thread or forum topic to which the message belongs; for supe...
Definition Message.hpp:84
std::int32_t messageId
Unique message identifier inside this chat.
Definition Message.hpp:81
bool isFromOffline
Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting ...
Definition Message.hpp:155
Ptr< SuggestedPostApprovalFailed > suggestedPostApprovalFailed
Optional. Service message: approval of a suggested post has failed.
Definition Message.hpp:393
Ptr< User > leftChatMember
Optional. A member was removed from the group, information about them (this member may be the bot its...
Definition Message.hpp:252
std::string senderTag
Optional. Tag or custom title of the sender of the message; for supergroups only.
Definition Message.hpp:106
Message()=default
Ptr< ChatOwnerChanged > chatOwnerChanged
Optional. Service message: chat owner has changed.
Definition Message.hpp:258
Ptr< GiftInfo > gift
Optional. Service message: a regular gift was sent or received.
Definition Message.hpp:319
bool isTopicMessage
Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bo...
Definition Message.hpp:123
std::vector< Ptr< PhotoSize > > photo
Optional. Message is a photo, available sizes of the photo.
Definition Message.hpp:196
Ptr< Story > story
Optional. Message is a forwarded story.
Definition Message.hpp:202
std::string authorSignature
Optional. Signature of the post author for messages in channels, or the custom title of an anonymous ...
Definition Message.hpp:165
std::string text
Optional. For text messages, the actual UTF-8 text of the message.
Definition Message.hpp:171
Ptr< Animation > animation
Optional. Message is an animation, information about the animation. For backward compatibility,...
Definition Message.hpp:187
Ptr< ForumTopicClosed > forumTopicClosed
Optional. Service message: forum topic closed.
Definition Message.hpp:363
Ptr< User > senderBusinessBot
Optional. The bot that actually sent the message on behalf of the business account....
Definition Message.hpp:103
Ptr< ForumTopicCreated > forumTopicCreated
Optional. Service message: forum topic created.
Definition Message.hpp:357
Ptr< SuccessfulPayment > successfulPayment
Optional. Message is a service message about a successful payment, information about the payment....
Definition Message.hpp:306
Ptr< User > viaBot
Optional. Bot through which the message was sent.
Definition Message.hpp:146
Ptr< Chat > senderChat
Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channe...
Definition Message.hpp:97
std::string mediaGroupId
Optional. The unique identifier of a media message group this message belongs to.
Definition Message.hpp:161
Ptr< VideoChatScheduled > videoChatScheduled
Optional. Service message: video chat scheduled.
Definition Message.hpp:405
std::string newChatTitle
Optional. A chat title was changed to this value.
Definition Message.hpp:261
std::int32_t replyToChecklistTaskId
Optional. Identifier of the specific checklist task that is being replied to.
Definition Message.hpp:143
bool supergroupChatCreated
Optional. Service message: the supergroup has been created. This field can't be received in a message...
Definition Message.hpp:275
Ptr< VideoChatEnded > videoChatEnded
Optional. Service message: video chat ended.
Definition Message.hpp:411
Ptr< GeneralForumTopicHidden > generalForumTopicHidden
Optional. Service message: the 'General' forum topic hidden.
Definition Message.hpp:369
Ptr< GiveawayWinners > giveawayWinners
Optional. A giveaway with public winners was completed.
Definition Message.hpp:381
Ptr< SuggestedPostDeclined > suggestedPostDeclined
Optional. Service message: a suggested post was declined.
Definition Message.hpp:396
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:100
Ptr< Location > location
Optional. Message is a shared location, information about the location.
Definition Message.hpp:246
Ptr< Document > document
Optional. Message is a general file, information about the file.
Definition Message.hpp:193
Ptr< Invoice > invoice
Optional. Message is an invoice for a payment, information about the invoice. about payments » https:...
Definition Message.hpp:302
Ptr< ChatShared > chatShared
Optional. Service message: a chat was shared with the bot.
Definition Message.hpp:316
Ptr< Video > video
Optional. Message is a video, information about the video.
Definition Message.hpp:205
std::string businessConnectionId
Optional. Unique identifier of the business connection from which the message was received....
Definition Message.hpp:114
Ptr< DirectMessagesTopic > directMessagesTopic
Optional. Information about the direct messages chat topic that contains the message.
Definition Message.hpp:87
Ptr< InlineKeyboardMarkup > replyMarkup
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url ...
Definition Message.hpp:420
std::string caption
Optional. Caption for the animation, audio, document, photo, video or voice.
Definition Message.hpp:214
Ptr< Message > replyToMessage
Optional. For replies, the original message. Note that the Message object in this field will not cont...
Definition Message.hpp:131
Ptr< ForumTopicEdited > forumTopicEdited
Optional. Service message: forum topic edited.
Definition Message.hpp:360
Ptr< ChatBackground > chatBackgroundSet
Optional. Service message: chat background set.
Definition Message.hpp:345
bool showCaptionAboveMedia
Optional. True, if the caption must be shown above the message media.
Definition Message.hpp:220
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:168
Ptr< SuggestedPostInfo > suggestedPostInfo
Optional. Information about suggested post parameters if the message is a suggested post in a channel...
Definition Message.hpp:180
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:417
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:158
std::int64_t migrateFromChatId
Optional. The supergroup has been migrated from a group with the specified identifier....
Definition Message.hpp:295
Ptr< GiveawayCompleted > giveawayCompleted
Optional. Service message: a giveaway without public winners was completed.
Definition Message.hpp:384
bool isAutomaticForward
Optional. True, if the message is a channel post that was automatically forwarded to the connected di...
Definition Message.hpp:127
Ptr< PassportData > passportData
Optional. Telegram Passport data.
Definition Message.hpp:336
Ptr< LinkPreviewOptions > linkPreviewOptions
Optional. Options used for link preview generation for the message, if it is a text message and link ...
Definition Message.hpp:177
std::string effectId
Optional. Unique identifier of the message effect added to the message.
Definition Message.hpp:183
Ptr< Giveaway > giveaway
Optional. The message is a scheduled giveaway message.
Definition Message.hpp:378
Ptr< RefundedPayment > refundedPayment
Optional. Message is a service message about a refunded payment, information about the payment....
Definition Message.hpp:310
Ptr< GiveawayCreated > giveawayCreated
Optional. Service message: a scheduled giveaway was created.
Definition Message.hpp:375
Ptr< Story > replyToStory
Optional. For replies to a story, the original story.
Definition Message.hpp:140
std::time_t editDate
Optional. Date the message was last edited in Unix time.
Definition Message.hpp:149
MaybeInaccessibleMessage pinnedMessage
Optional. Specified message was pinned. Note that the Message object in this field will not contain f...
Definition Message.hpp:298
Ptr< Contact > contact
Optional. Message is a shared contact, information about the contact.
Definition Message.hpp:229
Ptr< ProximityAlertTriggered > proximityAlertTriggered
Optional. Service message. A user in the chat triggered another user's proximity alert while sharing ...
Definition Message.hpp:339
Ptr< Dice > dice
Optional. Message is a dice with random value.
Definition Message.hpp:232
Ptr< ChecklistTasksAdded > checklistTasksAdded
Optional. Service message: tasks were added to a checklist.
Definition Message.hpp:351
Ptr< MessageAutoDeleteTimerChanged > messageAutoDeleteTimerChanged
Optional. Service message: auto-delete timer settings changed in the chat.
Definition Message.hpp:283
Ptr< Voice > voice
Optional. Message is a voice message, information about the file.
Definition Message.hpp:211
Ptr< UsersShared > usersShared
Optional. Service message: users were shared with the bot.
Definition Message.hpp:313
Ptr< ChatBoostAdded > boostAdded
Optional. Service message: user boosted the chat.
Definition Message.hpp:342
bool groupChatCreated
Optional. Service message: the group has been created.
Definition Message.hpp:270
Ptr< SuggestedPostPaid > suggestedPostPaid
Optional. Service message: payment for a suggested post was received.
Definition Message.hpp:399
Ptr< TextQuote > quote
Optional. For replies that quote part of the original message, the quoted part of the message.
Definition Message.hpp:137
Ptr< GiftInfo > giftUpgradeSent
Optional. Service message: upgrade of a gift was purchased after the gift was sent.
Definition Message.hpp:325
Ptr< User > from
Optional. Sender of the message; empty for messages sent to channels. For backward compatibility,...
Definition Message.hpp:91
Ptr< Poll > poll
Optional. Message is a native poll, information about the poll.
Definition Message.hpp:239
Ptr< VideoChatParticipantsInvited > videoChatParticipantsInvited
Optional. Service message: new participants invited to a video chat.
Definition Message.hpp:414
Ptr< WriteAccessAllowed > writeAccessAllowed
Optional. Service message: the user allowed the bot to write messages after adding it to the attachme...
Definition Message.hpp:333
Ptr< UniqueGiftInfo > uniqueGift
Optional. Service message: a unique gift was sent or received.
Definition Message.hpp:322
Ptr< PaidMessagePriceChanged > paidMessagePriceChanged
Optional. Service message: the price for paid messages has changed in the chat.
Definition Message.hpp:387
Ptr< Venue > venue
Optional. Message is a venue, information about the venue. For backward compatibility,...
Definition Message.hpp:243
bool hasProtectedContent
Optional. True, if the message can't be forwarded.
Definition Message.hpp:152
Ptr< Audio > audio
Optional. Message is an audio file, information about the file.
Definition Message.hpp:190
Ptr< VideoNote > videoNote
Optional. Message is a video note, information about the video message.
Definition Message.hpp:208
nl::json toJson() const
Serializes this object to JSON.
bool deleteChatPhoto
Optional. Service message: the chat photo was deleted.
Definition Message.hpp:267
std::vector< Ptr< PhotoSize > > newChatPhoto
Optional. A chat photo was change to this value.
Definition Message.hpp:264
Ptr< Chat > chat
Conversation the message belongs to.
Definition Message.hpp:117
Ptr< ForumTopicReopened > forumTopicReopened
Optional. Service message: forum topic reopened.
Definition Message.hpp:366
Ptr< Game > game
Optional. Message is a game, information about the game. about games » https://core....
Definition Message.hpp:236
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:109
Ptr< GeneralForumTopicUnhidden > generalForumTopicUnhidden
Optional. Service message: the 'General' forum topic unhidden.
Definition Message.hpp:372
Ptr< Checklist > checklist
Optional. Message is a checklist.
Definition Message.hpp:226
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:249