Struct teloxide::prelude::Message

source ·
pub struct Message {
    pub id: MessageId,
    pub thread_id: Option<i32>,
    pub date: DateTime<Utc>,
    pub chat: Chat,
    pub via_bot: Option<User>,
    pub kind: MessageKind,
}
Expand description

This object represents a message.

The official docs.

Fields§

§id: MessageId

Unique message identifier inside this chat.

§thread_id: Option<i32>

Unique identifier of a message thread to which the message belongs; for supergroups only.

§date: DateTime<Utc>

Date the message was sent in Unix time.

§chat: Chat

Conversation the message belongs to.

§via_bot: Option<User>

Bot through which the message was sent.

§kind: MessageKind

Implementations§

Getters for Message fields from telegram docs.

👎Deprecated since 0.4.2: use .chat.id field instead

Returns message entities that represent text formatting.

Note: you probably want to use parse_entities instead.

This function returns Some(entities) for text messages and None for all other kinds of messages (including photos with captions).

See also: caption_entities.

Returns message entities that represent text formatting.

Note: you probably want to use parse_caption_entities instead.

This function returns Some(entities) for media messages and None for all other kinds of messages (including text messages).

See also: entities.

Returns true if the message media is covered by a spoiler animation.

Getter for MediaPhoto::has_media_spoiler, MediaVideo::has_media_spoiler and MediaAnimation::has_media_spoiler.

Produces a direct link to this message.

Note that for private groups the link will only be accessible for group members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Produces a direct link to a message in a chat.

If you have a Message object, use url instead. This function should only be used if you have limited information about the message (chat id, username of the chat, if any and its id).

Note that for private groups the link will only be accessible for group members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Produces a direct link to a comment on this post.

Note that for private channels the link will only be accessible for channel members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Produces a direct link to a comment on a post.

If you have a Message object of the channel post, use comment_url instead. This function should only be used if you have limited information about the message (channel id, username of the channel, if any, post id and comment id).

Note that for private channels the link will only be accessible for channel members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Produces a direct link to this message in a given thread.

“Thread” is a group of messages that reply to each other in a tree-like structure. thread_starter_msg_id is the id of the first message in the thread, the root of the tree.

Note that for private groups the link will only be accessible for group members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Produces a direct link to a message in a given thread.

If you have a Message object of the channel post, use url_in_thread instead. This function should only be used if you have limited information about the message (chat id, username of the chat, if any, thread starter id and message id).

“Thread” is a group of messages that reply to each other in a tree-like structure. thread_starter_msg_id is the id of the first message in the thread, the root of the tree.

Note that for private groups the link will only be accessible for group members.

Returns None for private chats (i.e.: DMs) and private groups (not supergroups).

Returns message entities that represent text formatting.

This function returns Some(entities) for text messages and None for all other kinds of messages (including photos with captions).

See also: parse_caption_entities.

Returns message entities that represent text formatting.

This function returns Some(entities) for media messages and None for all other kinds of messages (including text messages).

See also: parse_entities.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Applies the Message::from filter.
Applies the Message::animation filter.
Applies the Message::audio filter.
Applies the Message::contact filter.
Applies the Message::document filter.
Applies the Message::location filter.
Applies the Message::photo filter.
Applies the Message::poll filter.
Applies the Message::sticker filter.
Applies the Message::text filter.
Applies the Message::reply_to_message filter.
Applies the Message::forward_from filter.
Applies the Message::new_chat_members filter.
Applies the Message::left_chat_member filter.
Applies the Message::pinned_message filter.
Applies the Message::dice filter.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Unerase this erased pointer. Read more
Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Turn this erasable pointer into an erased pointer. Read more

Returns the argument unchanged.

Converts to this type from a reference to the input type.
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more