pub struct Message {Show 24 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 external_reply: Option<ExternalReplyInfo>,
pub forward_origin: Option<MessageOrigin>,
pub has_media_spoiler: Option<bool>,
pub is_from_offline: 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 quote: Option<TextQuote>,
pub reply_markup: Option<InlineKeyboardMarkup>,
pub reply_to: Option<ReplyTo>,
pub sender_boost_count: Option<Integer>,
pub sender_business_bot: Option<User>,
pub via_bot: Option<User>,
pub data: MessageData,
}
Expand description
Represents a message.
Fields§
§chat: Chat
Chat the message belongs to.
date: Integer
Date the message was sent in Unix time.
edit_date: Option<Integer>
Date the message was last edited in Unix time.
has_protected_content: bool
Indicates whether the message can’t be forwarded.
id: Integer
Unique message identifier inside the chat.
is_automatic_forward: bool
Indicates whether the message is a channel post that was automatically forwarded to the connected discussion group.
sender: MessageSender
Sender 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.
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_topic_message: Option<bool>
Indicates whether the message is sent to a forum topic.
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 only.
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.
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.
via_bot: Option<User>
Bot through which the message was sent.
data: MessageData
Contains 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_edit_date(self, value: Integer) -> Self
pub fn with_edit_date(self, value: Integer) -> 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 a 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 an 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 a 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 an is_from_offline
flag.
§Arguments
value
- Indicates whether the message was sent by an implicit action.
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 an 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; supergroups only.
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_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_via_bot(self, value: User) -> Self
pub fn with_via_bot(self, value: User) -> Self
Trait Implementations§
source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for Message
impl PartialEq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more