Skip to main content

message

A message

type tg.Message struct { /* ... */ }

Implements Message.

Fields​

NameTypeRequiredDescription
Outbool—Is this an outgoing message
Mentionedbool—Whether we were mentioned in this message
MediaUnreadbool—Whether there are unread media attachments in this message
Silentbool—Whether this is a silent message (no notification triggered)
Postbool—Whether this is a channel post
FromScheduledbool—Whether this is a scheduled message
Legacybool—This is a legacy message: it has to be refetched with the new layer
EditHidebool—Whether the message should be shown as not modified to the user, even if an edit date is present
Pinnedbool—Whether this message is pinned
Noforwardsbool—Whether this message is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera).
InvertMediabool—If set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
Flags2bin.FieldsyesFlags, see TL conditional fields
Offlinebool—If set, the message was sent because of a scheduled action by the message sender, for example, as away, or a greeting service message.
VideoProcessingPendingbool—The video contained in the message is currently being processed by the server (i.e. to generate alternative qualities, that will be contained in the final messageMediaDocument.alt_document), and will be sent once the video is processed, which will happen approximately at the specified date (i.e. messages with this flag set should be treated similarly to scheduled messages, but instead of the scheduled date, date contains the estimated conversion date). See here » for more info.
PaidSuggestedPostStarsbool—Set if this is a suggested channel post » that was paid using Telegram Stars.
PaidSuggestedPostTonbool—Set if this is a suggested channel post » that was paid using Toncoins.
IDintyesID of the message
FromIDPeerClass—ID of the sender of the message
FromBoostsAppliedint—Supergroups only, contains the number of boosts this user has given the current supergroup, and should be shown in the UI in the header of the message. Only present for incoming messages from non-anonymous supergroup members that have boosted the supergroup. Note that this counter should be locally overridden for non-anonymous outgoing messages, according to the current value of channelFull.boosts_applied, to ensure the value is correct even for messages sent by the current user before a supergroup was boosted (or after a boost has expired or the number of boosts has changed); do not update this value for incoming messages from other users, even if their boosts have changed.
FromRankstring—Only in supergroups » (never basic groups, where this information is contained elsewhere »), contains the sender's tag ».
PeerIDPeerClassyesPeer ID, the chat where this message was sent
SavedPeerIDPeerClass—Messages from a saved messages dialog » will have peer=inputPeerSelf and the saved_peer_id flag set to the ID of the saved dialog.Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
FwdFromMessageFwdHeader—Info about forwarded messages
ViaBotIDint64—ID of the inline bot that generated the message
ViaBusinessBotIDint64—Whether the message was sent by the business bot specified in via_bot_id on behalf of the user.
GuestchatViaFromPeerClass—GuestchatViaFrom field of Message.
ReplyToMessageReplyHeaderClass—Reply information
DateintyesDate of the message
MessagestringyesThe message
MediaMessageMediaClass—Media attachment
ReplyMarkupReplyMarkupClass—Reply markup (bot/inline keyboards)
Entities[]MessageEntityClass—Message entities for styled text
Viewsint—View count for channel posts
Forwardsint—Forward counter
RepliesMessageReplies—Info about post comments (for channels) or message replies (for groups)
EditDateint—Last edit date of this message
PostAuthorstring—Name of the author of this message for channel posts (with signatures enabled)
GroupedIDint64—Multiple media messages sent using messages.sendMultiMedia with the same grouped ID indicate an album or media group
ReactionsMessageReactions—Reactions to this message
RestrictionReason[]RestrictionReason—Contains the reason why access to this message must be restricted.
TTLPeriodint—Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well.
QuickReplyShortcutIDint—If set, this message is a quick reply shortcut message » (note that quick reply shortcut messages sent to a private chat will not have this field set).
Effectint64—A message effect that should be played as specified here ».
FactcheckFactCheck—Represents a fact-check ».
ReportDeliveryUntilDateint—Used for Telegram Gateway verification messages: if set and the current unixtime is bigger than the specified unixtime, invoke messages.reportMessagesDelivery passing the ID and the peer of this message as soon as it is received by the client (optionally batching requests for the same peer).
PaidMessageStarsint64—The amount of stars the sender has paid to send the message, see here » for more info.
SuggestedPostSuggestedPost—Used to suggest a post to a channel, see here » for more info on the full flow.
ScheduleRepeatPeriodint—Once sent, this message will be automatically re-scheduled to be re-sent again this many seconds in the future, see here » for more info on repeating scheduled messages.
SummaryFromLanguagestring—SummaryFromLanguage field of Message.
RichMessageRichMessage—RichMessage field of Message.

References​