pub struct Message {Show 94 fields
pub message_id: i64,
pub message_thread_id: Option<i64>,
pub direct_messages_topic: Option<DirectMessagesTopic>,
pub from: Option<User>,
pub sender_chat: Option<Chat>,
pub sender_boost_count: Option<u32>,
pub sender_business_bot: Option<User>,
pub sender_tag: Option<String>,
pub date: i64,
pub business_connection_id: Option<String>,
pub chat: Chat,
pub forward_origin: Option<MessageOrigin>,
pub is_topic_message: Option<bool>,
pub is_automatic_forward: Option<bool>,
pub reply_to_message: Option<Box<Message>>,
pub external_reply: Option<ExternalReplyInfo>,
pub quote: Option<TextQuote>,
pub reply_to_story: Option<Value>,
pub reply_to_checklist_task_id: Option<i64>,
pub reply_to_poll_option_id: Option<String>,
pub via_bot: Option<User>,
pub edit_date: Option<i64>,
pub has_protected_content: Option<bool>,
pub is_from_offline: Option<bool>,
pub is_paid_post: Option<bool>,
pub media_group_id: Option<String>,
pub author_signature: Option<String>,
pub paid_star_count: Option<i64>,
pub text: Option<String>,
pub entities: Option<Vec<MessageEntity>>,
pub link_preview_options: Option<LinkPreviewOptions>,
pub suggested_post_info: Option<SuggestedPostInfo>,
pub effect_id: Option<String>,
pub animation: Option<Animation>,
pub audio: Option<Audio>,
pub document: Option<Document>,
pub paid_media: Option<Value>,
pub photo: Option<Vec<PhotoSize>>,
pub sticker: Option<Sticker>,
pub story: Option<Value>,
pub video: Option<Video>,
pub video_note: Option<VideoNote>,
pub voice: Option<Voice>,
pub caption: Option<String>,
pub caption_entities: Option<Vec<MessageEntity>>,
pub show_caption_above_media: Option<bool>,
pub has_media_spoiler: Option<bool>,
pub checklist: Option<Checklist>,
pub contact: Option<Contact>,
pub dice: Option<Dice>,
pub game: Option<Value>,
pub poll: Option<Poll>,
pub venue: Option<Venue>,
pub location: Option<Location>,
pub new_chat_members: Option<Vec<User>>,
pub left_chat_member: Option<User>,
pub chat_owner_left: Option<ChatOwnerLeft>,
pub chat_owner_changed: Option<ChatOwnerChanged>,
pub new_chat_title: Option<String>,
pub new_chat_photo: Option<Vec<PhotoSize>>,
pub delete_chat_photo: Option<bool>,
pub group_chat_created: Option<bool>,
pub supergroup_chat_created: Option<bool>,
pub channel_chat_created: Option<bool>,
pub message_auto_delete_timer_changed: Option<Value>,
pub migrate_to_chat_id: Option<i64>,
pub migrate_from_chat_id: Option<i64>,
pub pinned_message: Option<Box<Message>>,
pub reply_markup: Option<InlineKeyboardMarkup>,
pub invoice: Option<Value>,
pub successful_payment: Option<Value>,
pub refunded_payment: Option<Value>,
pub web_app_data: Option<WebAppData>,
pub forum_topic_created: Option<Value>,
pub forum_topic_edited: Option<Value>,
pub forum_topic_closed: Option<Value>,
pub forum_topic_reopened: Option<Value>,
pub general_forum_topic_hidden: Option<Value>,
pub general_forum_topic_unhidden: Option<Value>,
pub managed_bot_created: Option<ManagedBotCreated>,
pub poll_option_added: Option<PollOptionAdded>,
pub poll_option_deleted: Option<PollOptionDeleted>,
pub checklist_tasks_done: Option<ChecklistTasksDone>,
pub checklist_tasks_added: Option<ChecklistTasksAdded>,
pub direct_message_price_changed: Option<DirectMessagePriceChanged>,
pub paid_message_price_changed: Option<PaidMessagePriceChanged>,
pub suggested_post_approved: Option<SuggestedPostApproved>,
pub suggested_post_approval_failed: Option<SuggestedPostApprovalFailed>,
pub suggested_post_declined: Option<SuggestedPostDeclined>,
pub suggested_post_paid: Option<SuggestedPostPaid>,
pub suggested_post_refunded: Option<SuggestedPostRefunded>,
pub guest_bot_caller_user: Option<User>,
pub guest_bot_caller_chat: Option<Chat>,
pub guest_query_id: Option<String>,
}Expand description
A Telegram message.
Only fields that were actually sent will be Some. Consult the
official Bot API documentation for field availability rules.
Fields§
§message_id: i64Unique message identifier inside this chat.
message_thread_id: Option<i64>Optional — unique identifier of a message thread to which the message belongs.
direct_messages_topic: Option<DirectMessagesTopic>Information about the direct messages chat topic that contains the message.
from: Option<User>Sender of the message; empty for messages sent to channels.
sender_chat: Option<Chat>Sender of the message; empty for messages sent to channels or on behalf of a chat.
sender_boost_count: Option<u32>For supergroup messages — boost count of the sender.
sender_business_bot: Option<User>The bot that actually sent the message on behalf of the business account.
sender_tag: Option<String>Tag or custom title of the sender; for supergroups only (Bot API 9.5).
date: i64Date the message was sent, as a Unix timestamp.
business_connection_id: Option<String>Unique identifier of the business connection from which the message was received.
chat: ChatConversation the message belongs to.
forward_origin: Option<MessageOrigin>Information about the original message for forwarded messages.
is_topic_message: Option<bool>true if the message is sent to a forum topic.
is_automatic_forward: Option<bool>true if the message is a channel post automatically forwarded to the
connected discussion group.
reply_to_message: Option<Box<Message>>For replies in the same chat and message thread, the original message.
external_reply: Option<ExternalReplyInfo>Information about the message that is being replied to from another chat or topic.
quote: Option<TextQuote>For replies that quote part of the original message, the quoted part.
reply_to_story: Option<Value>For replies to a story, the original story.
reply_to_checklist_task_id: Option<i64>Identifier of the checklist task being replied to.
reply_to_poll_option_id: Option<String>Persistent identifier of the poll option being replied to.
via_bot: Option<User>Bot through which the message was sent.
edit_date: Option<i64>Date the message was last edited, as a Unix timestamp.
has_protected_content: Option<bool>true if the message can’t be forwarded.
is_from_offline: Option<bool>true if the message was sent by an implicit action.
is_paid_post: Option<bool>true if the message is a paid post.
Paid posts must not be deleted for 24 hours after sending and cannot be edited.
media_group_id: Option<String>The unique identifier of a media message group this message belongs to.
Signature of the post author for messages in channels.
paid_star_count: Option<i64>Number of Telegram Stars paid by the sender to send this message.
text: Option<String>Actual UTF-8 text of the message (0–4096 characters).
entities: Option<Vec<MessageEntity>>Special entities like usernames, URLs, bot commands, etc.
link_preview_options: Option<LinkPreviewOptions>Options used for link preview generation.
suggested_post_info: Option<SuggestedPostInfo>Information about a suggested post; present when the message is a suggested post in a channel direct messages chat.
effect_id: Option<String>Unique identifier of the message effect added to the message.
animation: Option<Animation>Animation attached to the message.
audio: Option<Audio>Audio file attached to the message.
document: Option<Document>Document attached to the message.
paid_media: Option<Value>Paid media attached to the message.
photo: Option<Vec<PhotoSize>>Photo attached to the message (array of sizes).
sticker: Option<Sticker>Sticker attached to the message.
story: Option<Value>Story attached to the message.
video: Option<Video>Video attached to the message.
video_note: Option<VideoNote>Video note attached to the message.
voice: Option<Voice>Voice note attached to the message.
caption: Option<String>Caption for the animation, audio, document, paid media, photo, video or voice.
caption_entities: Option<Vec<MessageEntity>>Special entities in the caption.
show_caption_above_media: Option<bool>true if the caption must be shown above the message media.
has_media_spoiler: Option<bool>true if the message media is covered by a spoiler animation.
checklist: Option<Checklist>Checklist attached to the message.
contact: Option<Contact>Contact shared in the message.
dice: Option<Dice>Dice result in the message.
game: Option<Value>Game in the message.
poll: Option<Poll>Poll in the message.
venue: Option<Venue>Venue in the message.
location: Option<Location>Location in the message.
new_chat_members: Option<Vec<User>>New members that joined the group.
left_chat_member: Option<User>A member that left the group.
chat_owner_left: Option<ChatOwnerLeft>Service message: chat owner has left.
chat_owner_changed: Option<ChatOwnerChanged>Service message: chat owner has changed.
new_chat_title: Option<String>New chat title (service message).
new_chat_photo: Option<Vec<PhotoSize>>New chat photo (service message).
delete_chat_photo: Option<bool>true if the chat photo was deleted (service message).
group_chat_created: Option<bool>true if the group was created (service message).
supergroup_chat_created: Option<bool>true if the supergroup was created (service message).
channel_chat_created: Option<bool>true if the channel was created (service message).
message_auto_delete_timer_changed: Option<Value>Auto-delete timer changed (service message).
migrate_to_chat_id: Option<i64>The group has been migrated to a supergroup with this ID.
migrate_from_chat_id: Option<i64>The supergroup has been migrated from a group with this ID.
pinned_message: Option<Box<Message>>The pinned message (service message).
reply_markup: Option<InlineKeyboardMarkup>Inline keyboard attached to the message.
invoice: Option<Value>Invoice for a payment (service message).
successful_payment: Option<Value>Successful payment information (service message).
refunded_payment: Option<Value>Refunded payment information (service message).
web_app_data: Option<WebAppData>Data from the Web App.
forum_topic_created: Option<Value>Forum topic created (service message).
forum_topic_edited: Option<Value>Forum topic edited (service message).
forum_topic_closed: Option<Value>Forum topic closed (service message).
forum_topic_reopened: Option<Value>Forum topic reopened (service message).
General forum topic hidden (service message).
General forum topic unhidden (service message).
managed_bot_created: Option<ManagedBotCreated>Service message: a new managed bot was created (Bot API 9.6).
poll_option_added: Option<PollOptionAdded>Service message: an option was added to a poll (Bot API 9.6).
poll_option_deleted: Option<PollOptionDeleted>Service message: an option was deleted from a poll (Bot API 9.6).
checklist_tasks_done: Option<ChecklistTasksDone>Service message: tasks in a checklist were marked done or not done.
checklist_tasks_added: Option<ChecklistTasksAdded>Service message: tasks were added to a checklist.
direct_message_price_changed: Option<DirectMessagePriceChanged>Service message: the price for paid messages in the direct messages chat changed.
paid_message_price_changed: Option<PaidMessagePriceChanged>Service message: the price for paid messages in the chat changed.
suggested_post_approved: Option<SuggestedPostApproved>Service message: a suggested post was approved.
suggested_post_approval_failed: Option<SuggestedPostApprovalFailed>Service message: approval of a suggested post has failed.
suggested_post_declined: Option<SuggestedPostDeclined>Service message: a suggested post was declined.
suggested_post_paid: Option<SuggestedPostPaid>Service message: payment for a suggested post was received.
suggested_post_refunded: Option<SuggestedPostRefunded>Service message: payment for a suggested post was refunded.
guest_bot_caller_user: Option<User>For a message sent by a guest bot, the user whose original message triggered the bot’s response.
guest_bot_caller_chat: Option<Chat>For a message sent by a guest bot, the chat whose original message triggered the bot’s response.
guest_query_id: Option<String>The unique identifier for the guest query.
Use with answerGuestQuery to send a
response. If non-empty, the message belongs to a chat of the corresponding business account
independent from any potential bot chat sharing the same identifier.
Implementations§
Source§impl Message
impl Message
Sourcepub fn effective_text(&self) -> Option<&str>
pub fn effective_text(&self) -> Option<&str>
Returns the effective text of the message — text or caption.
Sourcepub fn is_command(&self) -> bool
pub fn is_command(&self) -> bool
Returns true if the message is a command (text starts with /).