pub struct Message {
pub id: MessageId,
pub date: DateTime<Utc>,
pub chat: Chat,
pub via_bot: Option<User>,
pub kind: MessageKind,
}Expand description
This object represents a message.
Fields
id: MessageIdUnique message identifier inside this chat.
date: DateTime<Utc>Date the message was sent in Unix time.
chat: ChatConversation the message belongs to.
via_bot: Option<User>Bot through which the message was sent.
kind: MessageKindImplementations
sourceimpl Message
impl Message
Getters for Message fields from telegram docs.
pub fn from(&self) -> Option<&User>
pub fn sender_chat(&self) -> Option<&Chat>
pub fn chat_id(&self) -> ChatId
.chat.id field insteadpub fn forward(&self) -> Option<&Forward>
pub fn forward_date(&self) -> Option<DateTime<Utc>>
pub fn forward_from(&self) -> Option<&ForwardedFrom>
pub fn forward_from_user(&self) -> Option<&User>
pub fn forward_from_chat(&self) -> Option<&Chat>
pub fn forward_from_sender_name(&self) -> Option<&str>
pub fn forward_from_message_id(&self) -> Option<i32>
pub fn forward_signature(&self) -> Option<&str>
pub fn reply_to_message(&self) -> Option<&Message>
pub fn edit_date(&self) -> Option<&DateTime<Utc>>
pub fn media_group_id(&self) -> Option<&str>
pub fn text(&self) -> Option<&str>
sourcepub fn entities(&self) -> Option<&[MessageEntity]>
pub fn entities(&self) -> Option<&[MessageEntity]>
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.
sourcepub fn caption_entities(&self) -> Option<&[MessageEntity]>
pub fn caption_entities(&self) -> Option<&[MessageEntity]>
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.
pub fn audio(&self) -> Option<&Audio>
pub fn document(&self) -> Option<&Document>
pub fn animation(&self) -> Option<&Animation>
pub fn game(&self) -> Option<&Game>
pub fn photo(&self) -> Option<&[PhotoSize]>
pub fn sticker(&self) -> Option<&Sticker>
pub fn video(&self) -> Option<&Video>
pub fn voice(&self) -> Option<&Voice>
pub fn video_note(&self) -> Option<&VideoNote>
pub fn caption(&self) -> Option<&str>
pub fn contact(&self) -> Option<&Contact>
pub fn location(&self) -> Option<&Location>
pub fn venue(&self) -> Option<&Venue>
pub fn poll(&self) -> Option<&Poll>
pub fn new_chat_members(&self) -> Option<&[User]>
pub fn left_chat_member(&self) -> Option<&User>
pub fn new_chat_title(&self) -> Option<&str>
pub fn new_chat_photo(&self) -> Option<&[PhotoSize]>
pub fn delete_chat_photo(&self) -> Option<True>
pub fn group_chat_created(&self) -> Option<True>
pub fn super_group_chat_created(&self) -> Option<True>
pub fn channel_chat_created(&self) -> Option<True>
pub fn chat_migration(&self) -> Option<ChatMigration>
pub fn migrate_to_chat_id(&self) -> Option<ChatId>
pub fn migrate_from_chat_id(&self) -> Option<ChatId>
pub fn pinned_message(&self) -> Option<&Message>
pub fn invoice(&self) -> Option<&Invoice>
pub fn successful_payment(&self) -> Option<&SuccessfulPayment>
pub fn connected_website(&self) -> Option<&str>
pub fn passport_data(&self) -> Option<&PassportData>
pub fn dice(&self) -> Option<&Dice>
pub fn proximity_alert_triggered(&self) -> Option<&ProximityAlertTriggered>
pub fn reply_markup(&self) -> Option<&InlineKeyboardMarkup>
pub fn is_automatic_forward(&self) -> bool
pub fn has_protected_content(&self) -> bool
sourceimpl Message
impl Message
sourcepub fn url(&self) -> Option<Url>
pub fn url(&self) -> Option<Url>
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).
sourcepub fn url_of(
chat_id: ChatId,
chat_username: Option<&str>,
message_id: MessageId
) -> Option<Url>
pub fn url_of(
chat_id: ChatId,
chat_username: Option<&str>,
message_id: MessageId
) -> Option<Url>
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).
sourcepub fn comment_url(&self, comment_id: MessageId) -> Option<Url>
pub fn comment_url(&self, comment_id: MessageId) -> Option<Url>
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).
sourcepub fn comment_url_of(
channel_id: ChatId,
channel_username: Option<&str>,
post_id: MessageId,
comment_id: MessageId
) -> Option<Url>
pub fn comment_url_of(
channel_id: ChatId,
channel_username: Option<&str>,
post_id: MessageId,
comment_id: MessageId
) -> Option<Url>
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).
sourcepub fn url_in_thread(&self, thread_starter_msg_id: MessageId) -> Option<Url>
pub fn url_in_thread(&self, thread_starter_msg_id: MessageId) -> Option<Url>
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).
sourcepub fn url_in_thread_of(
chat_id: ChatId,
chat_username: Option<&str>,
thread_starter_msg_id: MessageId,
message_id: MessageId
) -> Option<Url>
pub fn url_in_thread_of(
chat_id: ChatId,
chat_username: Option<&str>,
thread_starter_msg_id: MessageId,
message_id: MessageId
) -> Option<Url>
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).
sourcepub fn parse_entities(&self) -> Option<Vec<MessageEntityRef<'_>, Global>>
pub fn parse_entities(&self) -> Option<Vec<MessageEntityRef<'_>, Global>>
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.
sourcepub fn parse_caption_entities(
&self
) -> Option<Vec<MessageEntityRef<'_>, Global>>
pub fn parse_caption_entities(
&self
) -> Option<Vec<MessageEntityRef<'_>, Global>>
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
sourceimpl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Message, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Message, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
sourceimpl<Out> MessageFilterExt<Out> for Messagewhere
Out: Send + Sync + 'static,
impl<Out> MessageFilterExt<Out> for Messagewhere
Out: Send + Sync + 'static,
sourcefn filter_from() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_from() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::from filter.sourcefn filter_animation(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_animation(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::animation filter.sourcefn filter_audio() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_audio() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::audio filter.sourcefn filter_contact(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_contact(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::contact filter.sourcefn filter_document(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_document(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::document filter.sourcefn filter_location(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_location(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::location filter.sourcefn filter_photo() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_photo() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::photo filter.sourcefn filter_poll() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_poll() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::poll filter.sourcefn filter_sticker(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_sticker(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::sticker filter.sourcefn filter_text() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_text() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::text filter.sourcefn filter_reply_to_message(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_reply_to_message(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::reply_to_message filter.sourcefn filter_forward_from(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_forward_from(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::forward_from filter.sourcefn filter_new_chat_members(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_new_chat_members(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::new_chat_members filter.sourcefn filter_left_chat_member(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_left_chat_member(
) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::left_chat_member filter.sourcefn filter_pinned() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_pinned() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::pinned_message filter.sourcefn filter_dice() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
fn filter_dice() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>
Message::dice filter.