tgbotxx  1.1.6.9
Telegram Bot C++ Library
Message.hpp
Go to the documentation of this file.
1 #pragma once
12 #include <tgbotxx/objects/Game.hpp>
23 #include <tgbotxx/objects/Poll.hpp>
28 #include <tgbotxx/objects/User.hpp>
40 
41 namespace tgbotxx {
44  struct Chat;
45 
48  struct Message {
49  Message() = default;
50  explicit Message(const nl::json& json) {
51  fromJson(json);
52  }
53 
55  std::int32_t messageId{};
56 
58  std::int32_t messageThreadId{};
59 
63 
69 
71  std::time_t date{};
72 
75 
78 
82 
84  std::int32_t forwardFromMessageId{};
85 
88  std::string forwardSignature;
89 
92  std::string forwardSenderName;
93 
95  std::time_t forwardDate{};
96 
99 
103 
107 
110 
112  std::time_t editDate{};
113 
116 
118  std::string mediaGroupId;
119 
122  std::string authorSignature;
123 
125  std::string text;
126 
128  std::vector<Ptr<MessageEntity>> entities;
129 
133 
136 
139 
141  std::vector<Ptr<PhotoSize>> photo;
142 
145 
148 
151 
154 
157 
159  std::string caption;
160 
162  std::vector<Ptr<MessageEntity>> captionEntities;
163 
166 
169 
172 
176 
179 
183 
186 
188  std::vector<Ptr<User>> newChatMembers;
189 
192 
194  std::string newChatTitle;
195 
198 
201 
204 
209 
214 
217 
222  std::int64_t migrateToChatId{};
223 
228  std::int64_t migrateFromChatId{};
229 
232 
236 
240 
243 
246 
249  std::string connectedWebsite;
250 
254 
257 
260 
263 
266 
269 
272 
275 
278 
281 
284 
287 
290 
293 
296 
297 
300  nl::json toJson() const;
301 
303  void fromJson(const nl::json& json);
304  };
305 }
Definition: Api.hpp:14
std::shared_ptr< T > Ptr
Definition: Ptr.hpp:6
This object represents a message. https://core.telegram.org/bots/api#message.
Definition: Message.hpp:48
std::int64_t migrateToChatId
Optional. The group has been migrated to a supergroup with the specified identifier....
Definition: Message.hpp:222
bool channelChatCreated
Optional. Service message: the channel has been created. This field can't be received in a message co...
Definition: Message.hpp:213
bool hasMediaSpoiler
Optional. True, if the message media is covered by a spoiler animation.
Definition: Message.hpp:165
Ptr< Message > pinnedMessage
Optional. Specified message was pinned. Note that the Message object in this field will not contain f...
Definition: Message.hpp:231
std::vector< Ptr< MessageEntity > > entities
Optional. For text messages, special entities like usernames, URLs, bot commands, etc....
Definition: Message.hpp:128
Ptr< VideoChatStarted > videoChatStarted
Optional. Service message: video chat started.
Definition: Message.hpp:283
Ptr< Chat > forwardFromChat
Optional. For messages forwarded from channels or from anonymous administrators, information about th...
Definition: Message.hpp:81
Ptr< Sticker > sticker
Optional. Message is a sticker, information about the sticker.
Definition: Message.hpp:144
std::vector< Ptr< MessageEntity > > captionEntities
Optional. For messages with a caption, special entities like usernames, URLs, bot commands,...
Definition: Message.hpp:162
std::string connectedWebsite
Optional. The domain name of the website on which the user has logged in. about Telegram Login » http...
Definition: Message.hpp:249
Message(const nl::json &json)
Definition: Message.hpp:50
std::int32_t messageThreadId
Optional. Unique identifier of a message thread to which the message belongs; for supergroups only.
Definition: Message.hpp:58
std::int32_t messageId
Unique message identifier inside this chat.
Definition: Message.hpp:55
Ptr< User > leftChatMember
Optional. A member was removed from the group, information about them (this member may be the bot its...
Definition: Message.hpp:191
Message()=default
bool isTopicMessage
Optional. True, if the message is sent to a forum topic.
Definition: Message.hpp:98
std::vector< Ptr< PhotoSize > > photo
Optional. Message is a photo, available sizes of the photo.
Definition: Message.hpp:141
Ptr< Story > story
Optional. Message is a forwarded story.
Definition: Message.hpp:147
std::string authorSignature
Optional. Signature of the post author for messages in channels, or the custom title of an anonymous ...
Definition: Message.hpp:122
std::string text
Optional. For text messages, the actual UTF-8 text of the message.
Definition: Message.hpp:125
Ptr< Animation > animation
Optional. Message is an animation, information about the animation. For backward compatibility,...
Definition: Message.hpp:132
Ptr< ForumTopicClosed > forumTopicClosed
Optional. Service message: forum topic closed.
Definition: Message.hpp:268
Ptr< ForumTopicCreated > forumTopicCreated
Optional. Service message: forum topic created.
Definition: Message.hpp:262
Ptr< SuccessfulPayment > successfulPayment
Optional. Message is a service message about a successful payment, information about the payment....
Definition: Message.hpp:239
Ptr< User > forwardFrom
Optional. For forwarded messages, sender of the original message.
Definition: Message.hpp:77
Ptr< User > viaBot
Optional. Bot through which the message was sent.
Definition: Message.hpp:109
Ptr< Chat > senderChat
Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channe...
Definition: Message.hpp:68
std::string mediaGroupId
Optional. The unique identifier of a media message group this message belongs to.
Definition: Message.hpp:118
Ptr< VideoChatScheduled > videoChatScheduled
Optional. Service message: video chat scheduled.
Definition: Message.hpp:280
std::string newChatTitle
Optional. A chat title was changed to this value.
Definition: Message.hpp:194
std::string forwardSignature
Optional. For forwarded messages that were originally sent in channels or by an anonymous chat admini...
Definition: Message.hpp:88
bool supergroupChatCreated
Optional. Service message: the supergroup has been created. This field can't be received in a message...
Definition: Message.hpp:208
Ptr< VideoChatEnded > videoChatEnded
Optional. Service message: video chat ended.
Definition: Message.hpp:286
Ptr< GeneralForumTopicHidden > generalForumTopicHidden
Optional. Service message: the 'General' forum topic hidden.
Definition: Message.hpp:274
std::time_t forwardDate
Optional. For forwarded messages, date the original message was sent in Unix time.
Definition: Message.hpp:95
Ptr< Location > location
Optional. Message is a shared location, information about the location.
Definition: Message.hpp:185
Ptr< Document > document
Optional. Message is a general file, information about the file.
Definition: Message.hpp:138
Ptr< Invoice > invoice
Optional. Message is an invoice for a payment, information about the invoice. about payments » https:...
Definition: Message.hpp:235
Ptr< ChatShared > chatShared
Optional. Service message: a chat was shared with the bot.
Definition: Message.hpp:245
Ptr< UserShared > userShared
Optional. Service message: a user was shared with the bot.
Definition: Message.hpp:242
Ptr< Video > video
Optional. Message is a video, information about the video.
Definition: Message.hpp:150
std::int32_t forwardFromMessageId
Optional. For messages forwarded from channels, identifier of the original message in the channel.
Definition: Message.hpp:84
Ptr< InlineKeyboardMarkup > replyMarkup
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url ...
Definition: Message.hpp:295
std::string caption
Optional. Caption for the animation, audio, document, photo, video or voice.
Definition: Message.hpp:159
Ptr< Message > replyToMessage
Optional. For replies, the original message. Note that the Message object in this field will not cont...
Definition: Message.hpp:106
Ptr< ForumTopicEdited > forumTopicEdited
Optional. Service message: forum topic edited.
Definition: Message.hpp:265
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:292
std::int64_t migrateFromChatId
Optional. The supergroup has been migrated from a group with the specified identifier....
Definition: Message.hpp:228
bool isAutomaticForward
Optional. True, if the message is a channel post that was automatically forwarded to the connected di...
Definition: Message.hpp:102
Ptr< PassportData > passportData
Optional. Telegram Passport data.
Definition: Message.hpp:256
std::time_t editDate
Optional. Date the message was last edited in Unix time.
Definition: Message.hpp:112
Ptr< Contact > contact
Optional. Message is a shared contact, information about the contact.
Definition: Message.hpp:168
Ptr< ProximityAlertTriggered > proximityAlertTriggered
Optional. Service message. A user in the chat triggered another user's proximity alert while sharing ...
Definition: Message.hpp:259
std::string forwardSenderName
Optional. Sender's name for messages forwarded from users who disallow adding a link to their account...
Definition: Message.hpp:92
Ptr< Dice > dice
Optional. Message is a dice with random value.
Definition: Message.hpp:171
Ptr< MessageAutoDeleteTimerChanged > messageAutoDeleteTimerChanged
Optional. Service message: auto-delete timer settings changed in the chat.
Definition: Message.hpp:216
Ptr< Voice > voice
Optional. Message is a voice message, information about the file.
Definition: Message.hpp:156
bool groupChatCreated
Optional. Service message: the group has been created.
Definition: Message.hpp:203
Ptr< User > from
Optional. Sender of the message; empty for messages sent to channels. For backward compatibility,...
Definition: Message.hpp:62
Ptr< Poll > poll
Optional. Message is a native poll, information about the poll.
Definition: Message.hpp:178
Ptr< VideoChatParticipantsInvited > videoChatParticipantsInvited
Optional. Service message: new participants invited to a video chat.
Definition: Message.hpp:289
Ptr< WriteAccessAllowed > writeAccessAllowed
Optional. Service message: the user allowed the bot to write messages after adding it to the attachme...
Definition: Message.hpp:253
Ptr< PhotoSize > newChatPhoto
Optional. A chat photo was change to this value.
Definition: Message.hpp:197
Ptr< Venue > venue
Optional. Message is a venue, information about the venue. For backward compatibility,...
Definition: Message.hpp:182
bool hasProtectedContent
Optional. True, if the message can't be forwarded.
Definition: Message.hpp:115
Ptr< Audio > audio
Optional. Message is an audio file, information about the file.
Definition: Message.hpp:135
Ptr< VideoNote > videoNote
Optional. Message is a video note, information about the video message.
Definition: Message.hpp:153
nl::json toJson() const
Serializes this object to JSON.
bool deleteChatPhoto
Optional. Service message: the chat photo was deleted.
Definition: Message.hpp:200
Ptr< Chat > chat
Conversation the message belongs to.
Definition: Message.hpp:74
Ptr< ForumTopicReopened > forumTopicReopened
Optional. Service message: forum topic reopened.
Definition: Message.hpp:271
Ptr< Game > game
Optional. Message is a game, information about the game. about games » https://core....
Definition: Message.hpp:175
std::time_t date
Date the message was sent in Unix time.
Definition: Message.hpp:71
Ptr< GeneralForumTopicUnhidden > generalForumTopicUnhidden
Optional. Service message: the 'General' forum topic unhidden.
Definition: Message.hpp:277
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:188