pub struct Message {Show 31 fields
pub chat: Chat,
pub date: Integer,
pub edit_date: Option<Integer>,
pub has_protected_content: bool,
pub id: Integer,
pub is_automatic_forward: bool,
pub sender: MessageSender,
pub author_signature: Option<String>,
pub business_connection_id: Option<String>,
pub direct_messages_topic: Option<DirectMessagesTopic>,
pub effect_id: Option<String>,
pub external_reply: Option<ExternalReplyInfo>,
pub forward_origin: Option<MessageOrigin>,
pub has_media_spoiler: Option<bool>,
pub is_from_offline: Option<bool>,
pub is_paid_post: Option<bool>,
pub is_topic_message: Option<bool>,
pub link_preview_options: Option<LinkPreviewOptions>,
pub media_group_id: Option<String>,
pub message_thread_id: Option<Integer>,
pub paid_star_count: Option<Integer>,
pub quote: Option<TextQuote>,
pub reply_markup: Option<InlineKeyboardMarkup>,
pub reply_to: Option<ReplyTo>,
pub reply_to_checklist_task_id: Option<Integer>,
pub sender_boost_count: Option<Integer>,
pub sender_business_bot: Option<User>,
pub show_caption_above_media: Option<bool>,
pub suggested_post_info: Option<SuggestedPostInfo>,
pub via_bot: Option<User>,
pub data: MessageData,
}Expand description
Represents a message.
Fields§
§chat: ChatChat the message belongs to.
date: IntegerDate the message was sent in Unix time.
edit_date: Option<Integer>Date the message was last edited in Unix time.
has_protected_content: boolIndicates whether the message can’t be forwarded.
id: IntegerUnique message identifier inside the chat.
is_automatic_forward: boolIndicates whether the message is a channel post that was automatically forwarded to the connected discussion group.
sender: MessageSenderSender of the message.
Author signature.
business_connection_id: Option<String>Unique identifier of the business connection from which the message was received.
If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
direct_messages_topic: Option<DirectMessagesTopic>Information about the direct messages chat topic that contains the message.
effect_id: Option<String>Unique identifier of the message effect added to the message.
external_reply: Option<ExternalReplyInfo>Information about the message that is being replied to, which may come from another chat or forum topic.
forward_origin: Option<MessageOrigin>formation about the original message for forwarded messages.
has_media_spoiler: Option<bool>Indicates whether the message media is covered by a spoiler animation.
is_from_offline: Option<bool>Whether the message was sent by an implicit action.
For example, as an away or a greeting business message, or as a scheduled message.
is_paid_post: Option<bool>Whether the message is a paid post.
Note that such posts must not be deleted for 24 hours to receive the payment and can’t be edited.
is_topic_message: Option<bool>Indicates whether the message is sent to a topic in a forum supergroup or a private chat with the bot.
link_preview_options: Option<LinkPreviewOptions>Options used for link preview generation for the message, if it is a text message and link preview options were changed.
media_group_id: Option<String>Unique identifier of a media message group this message belongs to.
message_thread_id: Option<Integer>Unique identifier of a message thread to which the message belongs; for supergroups and private chats only.
paid_star_count: Option<Integer>The number of Telegram Stars that were paid by the sender of the message to send it.
quote: Option<TextQuote>For replies that quote part of the original message, the quoted part of the message.
reply_markup: Option<InlineKeyboardMarkup>Inline keyboard attached to the message.
reply_to: Option<ReplyTo>For replies, the original message or story.
reply_to_checklist_task_id: Option<Integer>Identifier of the specific checklist task that is being replied to.
sender_boost_count: Option<Integer>Number of boosts added by the user.
Contains a value only if the sender of the message boosted the chat.
sender_business_bot: Option<User>The bot that actually sent the message on behalf of the business account.
Available only for outgoing messages sent on behalf of the connected business account.
show_caption_above_media: Option<bool>Whether the caption must be shown above the message media.
suggested_post_info: Option<SuggestedPostInfo>Information about suggested post parameters if the message is a suggested post in a channel direct messages chat.
If the message is an approved or declined suggested post, then it can’t be edited.
via_bot: Option<User>Bot through which the message was sent.
data: MessageDataContains message data.
Implementations§
Source§impl Message
impl Message
Sourcepub fn new<A, B>(
id: Integer,
date: Integer,
chat: A,
data: MessageData,
sender: B,
) -> Self
pub fn new<A, B>( id: Integer, date: Integer, chat: A, data: MessageData, sender: B, ) -> Self
Creates a new Message.
§Arguments
id- Unique message identifier inside the chat.date- Date the message was sent in Unix time.chat- Chat the message belongs to.data- Data of the message.sender- Sender of the message.
Sourcepub fn with_data(self, value: MessageData) -> Self
pub fn with_data(self, value: MessageData) -> Self
Sourcepub fn with_direct_messages_topic(self, value: DirectMessagesTopic) -> Self
pub fn with_direct_messages_topic(self, value: DirectMessagesTopic) -> Self
Sets a new direct messages topic.
§Arguments
value- Information about the direct messages chat topic that contains the message.
Sourcepub fn with_edit_date(self, value: Integer) -> Self
pub fn with_edit_date(self, value: Integer) -> Self
Sourcepub fn with_effect_id<T>(self, value: T) -> Self
pub fn with_effect_id<T>(self, value: T) -> Self
Sourcepub fn with_has_protected_content(self, value: bool) -> Self
pub fn with_has_protected_content(self, value: bool) -> Self
Sets a new value for the has_protected_content flag.
§Arguments
value- Indicates whether messages from the chat can’t be forwarded to other chats.
Sourcepub fn with_is_automatic_forward(self, value: bool) -> Self
pub fn with_is_automatic_forward(self, value: bool) -> Self
Sets a new value for the is_automatic_forward flag.
§Arguments
value- Indicates whether the message was automatically forwarded.
Sourcepub fn with_sender<T>(self, value: T) -> Selfwhere
T: Into<MessageSender>,
pub fn with_sender<T>(self, value: T) -> Selfwhere
T: Into<MessageSender>,
Sourcepub fn with_business_connection_id<T>(self, value: T) -> Self
pub fn with_business_connection_id<T>(self, value: T) -> Self
Sets a new business connection ID.
§Arguments
value- Unique identifier of the business connection from which the message was received.
Sourcepub fn with_external_reply(self, value: ExternalReplyInfo) -> Self
pub fn with_external_reply(self, value: ExternalReplyInfo) -> Self
Sets a new external reply.
§Arguments
value- Information about the message that is being replied to, which may come from another chat or forum topic.
Sourcepub fn with_forward_origin(self, value: MessageOrigin) -> Self
pub fn with_forward_origin(self, value: MessageOrigin) -> Self
Sourcepub fn with_has_media_spoiler(self, value: bool) -> Self
pub fn with_has_media_spoiler(self, value: bool) -> Self
Sets a new value for the has_media_spoiler flag.
§Arguments
value- Indicates whether the message has a media spoiler.
Sourcepub fn with_is_from_offline(self, value: bool) -> Self
pub fn with_is_from_offline(self, value: bool) -> Self
Sets a new value for the is_from_offline flag.
§Arguments
value- Indicates whether the message was sent by an implicit action.
Sourcepub fn with_is_paid_post(self, value: bool) -> Self
pub fn with_is_paid_post(self, value: bool) -> Self
Sourcepub fn with_is_topic_message(self, value: bool) -> Self
pub fn with_is_topic_message(self, value: bool) -> Self
Sets a new value for the is_topic_message flag.
§Arguments
value- Indicates whether the message is a topic message.
Sourcepub fn with_link_preview_options(self, value: LinkPreviewOptions) -> Self
pub fn with_link_preview_options(self, value: LinkPreviewOptions) -> Self
Sourcepub fn with_media_group_id<T>(self, value: T) -> Self
pub fn with_media_group_id<T>(self, value: T) -> Self
Sourcepub fn with_message_thread_id(self, value: Integer) -> Self
pub fn with_message_thread_id(self, value: Integer) -> Self
Sets a new message thread ID.
§Arguments
value- Unique identifier of the target message thread; for forum supergroups and private chats of bots with forum topic mode enabled only.
Sourcepub fn with_paid_star_count(self, value: Integer) -> Self
pub fn with_paid_star_count(self, value: Integer) -> Self
Sets a new paid star count
§Arguments
value- The number of Telegram Stars that were paid by the sender of the message to send it.
Sourcepub fn with_quote(self, value: TextQuote) -> Self
pub fn with_quote(self, value: TextQuote) -> Self
Sourcepub fn with_reply_markup<T>(self, value: T) -> Selfwhere
T: Into<InlineKeyboardMarkup>,
pub fn with_reply_markup<T>(self, value: T) -> Selfwhere
T: Into<InlineKeyboardMarkup>,
Sourcepub fn with_reply_to<T>(self, value: T) -> Self
pub fn with_reply_to<T>(self, value: T) -> Self
Sets a new original message or story for the reply.
§Arguments
value- For replies, the original message or story.
Sourcepub fn with_reply_to_checklist_task_id(self, value: Integer) -> Self
pub fn with_reply_to_checklist_task_id(self, value: Integer) -> Self
Sets a new reply checklist task ID.
§Arguments
value- Identifier of the specific checklist task that is being replied to.
Sourcepub fn with_sender_boost_count(self, value: Integer) -> Self
pub fn with_sender_boost_count(self, value: Integer) -> Self
Sourcepub fn with_sender_business_bot(self, value: User) -> Self
pub fn with_sender_business_bot(self, value: User) -> Self
Sets a new bot.
§Arguments
value- The bot that actually sent the message on behalf of the business account.
Sourcepub fn with_show_caption_above_media(self, value: bool) -> Self
pub fn with_show_caption_above_media(self, value: bool) -> Self
Sets a new value for the show_caption_above_media flag.
§Arguments
value- Whether the caption must be shown above the message media.