Message struct represents a Telegram message and is returned by most send/edit operations.
Message
Core Fields
Unique message identifier inside the chat. JSON:
message_id.Thread (topic) identifier for supergroup forum messages. JSON:
message_thread_id.The user who sent the message.
nil for channel posts.Unix timestamp of the message. Use
Message.Time() to obtain a time.Time.The conversation the message belongs to.
Sender chat when a message is sent on behalf of a chat.
Text and Caption
UTF-8 text content for plain text messages.
Command arguments extracted from the message text. For
/start deep-link, this holds the deep-link parameter. Not serialized from JSON — populated by Telebot during update processing.Special entities in
Text (mentions, URLs, commands, etc.).Caption for media messages (photo, video, etc.).
Special entities in
Caption.Unique identifier of a message effect applied to the message.
Forward / Reply Info
Original sender for forwarded messages. JSON:
forward_from.Original channel chat for forwarded channel posts. JSON:
forward_from_chat.Original message identifier for forwarded channel posts.
Unix timestamp of the original forwarded message.
Structured origin information for forwarded messages (
forward_origin).true when the message is a channel post automatically forwarded to the linked discussion group.The message being replied to. Does not contain nested
ReplyTo.Information about a reply to a message from another chat or topic.
The quoted portion of the replied-to message.
Bot through which the message was sent (inline mode). JSON:
via_bot.Media Fields
Highest-resolution photo thumbnail.
Audio file information.
Video file information.
General file information.
Voice message information.
Video note (round video) information.
GIF or H.264 animation information.
Sticker information.
Shared contact.
Shared geographic location.
Venue information.
Native poll.
Game information.
Animated dice result.
Paid media content attached to the message.
Service Message Fields
User who just joined the chat. JSON:
new_chat_member.Multiple users who joined simultaneously. JSON:
new_chat_members.User who left the chat. JSON:
left_chat_member.New chat title service message.
New chat photo service message.
true if the group was just created.true if a supergroup was just created.true if a channel was just created.The supergroup chat ID that this group migrated to.
The old group chat ID that this supergroup migrated from.
Service message about a pinned message.
Invoice for a payment.
Service message about a successful payment. JSON:
successful_payment.Service message about a refunded payment.
true if the message content is protected from forwarding and saving.Media group identifier — all messages in the same album share this ID. JSON:
media_group_id.Author signature for channel posts.
true if sent inside a forum topic.Inline keyboard attached to the message.
Unix timestamp of the last edit. Use
Message.LastEdited() to get time.Time.Identifier of the business connection the message belongs to.
Methods
Time
LastEdited
MessageSig
Editable interface. Returns (strconv.Itoa(m.ID), m.Chat.ID).
Inaccessible
true when the message is an inaccessible message object (sender is nil).
IsForwarded
true if the message is a forwarded copy.
IsReply
true if the message is a reply to another message.
Private
true for direct/private messages.
FromGroup
true for group or supergroup messages.
FromChannel
true for channel posts.
IsService
true for service messages (joins, title changes, migrations, etc.).
Media
nil if none.
EntityText
MessageEntity
The entity type.
Start offset in UTF-16 code units.
Length in UTF-16 code units.
URL for
EntityTextLink type.User for
EntityTMention type.Programming language for
EntityCodeBlock type.Custom emoji ID for
EntityCustomEmoji type.Entity Type Constants
Entities is a named type alias:
StoredMessage
A convenience struct suitable for storing in a database and later using as anEditable.
MessageOrigin
Describes the original source of a forwarded message.mo.Time() to obtain the original send time as time.Time.