Struct Message

Source
pub struct Message {
Show 59 fields pub message_id: i64, pub from: Option<User>, pub sender_chat: Option<Box<Chat>>, pub date: i64, pub chat: Box<Chat>, pub forward_from: Option<User>, pub forward_from_chat: Option<Box<Chat>>, pub forward_from_message_id: Option<i64>, pub forward_signature: Option<String>, pub forward_sender_name: Option<String>, pub forward_date: Option<i64>, pub is_automatic_forward: Option<bool>, pub reply_to_message: Option<Box<Message>>, pub via_bot: Option<User>, pub edit_date: Option<i64>, pub has_protected_content: Option<bool>, pub media_group_id: Option<String>, pub author_signature: Option<String>, pub text: Option<String>, pub entities: Option<Vec<MessageEntity>>, pub animation: Option<Animation>, pub audio: Option<Audio>, pub document: Option<Document>, pub photo: Option<Vec<PhotoSize>>, pub sticker: Option<Sticker>, pub video: Option<Video>, pub video_note: Option<VideoNote>, pub voice: Option<Voice>, pub caption: Option<String>, pub caption_entities: Option<Vec<MessageEntity>>, pub contact: Option<Contact>, pub dice: Option<Dice>, pub game: Option<Game>, 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 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<MessageAutoDeleteTimerChanged>, pub migrate_to_chat_id: Option<i64>, pub migrate_from_chat_id: Option<i64>, pub pinned_message: Option<Box<Message>>, pub invoice: Option<Invoice>, pub successful_payment: Option<SuccessfulPayment>, pub connected_website: Option<String>, pub passport_data: Option<PassportData>, pub proximity_alert_triggered: Option<ProximityAlertTriggered>, pub video_chat_scheduled: Option<VideoChatScheduled>, pub video_chat_started: Option<VideoChatStarted>, pub video_chat_ended: Option<VideoChatEnded>, pub video_chat_participants_invited: Option<VideoChatParticipantsInvited>, pub web_app_data: Option<WebAppData>, pub reply_markup: Option<InlineKeyboardMarkup>,
}
Expand description

This object represents a message.

Fields§

§message_id: i64

Unique message identifier inside this chat

§from: Option<User>

Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

§sender_chat: Option<Box<Chat>>

Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

§date: i64

Date the message was sent in Unix time

§chat: Box<Chat>

Conversation the message belongs to

§forward_from: Option<User>

Optional. For forwarded messages, sender of the original message

§forward_from_chat: Option<Box<Chat>>

Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat

§forward_from_message_id: Option<i64>

Optional. For messages forwarded from channels, identifier of the original message in the channel

§forward_signature: Option<String>

Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present

§forward_sender_name: Option<String>

Optional. Sender’s name for messages forwarded from users who disallow adding a link to their account in forwarded messages

§forward_date: Option<i64>

Optional. For forwarded messages, date the original message was sent in Unix time

§is_automatic_forward: Option<bool>

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group

§reply_to_message: Option<Box<Message>>

Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.

§via_bot: Option<User>

Optional. Bot through which the message was sent

§edit_date: Option<i64>

Optional. Date the message was last edited in Unix time

§has_protected_content: Option<bool>

Optional. True, if the message can’t be forwarded

§media_group_id: Option<String>

Optional. The unique identifier of a media message group this message belongs to

§author_signature: Option<String>

Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator

§text: Option<String>

Optional. For text messages, the actual UTF-8 text of the message

§entities: Option<Vec<MessageEntity>>

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text

§animation: Option<Animation>

Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set

§audio: Option<Audio>

Optional. Message is an audio file, information about the file

§document: Option<Document>

Optional. Message is a general file, information about the file

§photo: Option<Vec<PhotoSize>>

Optional. Message is a photo, available sizes of the photo

§sticker: Option<Sticker>

Optional. Message is a sticker, information about the sticker

§video: Option<Video>

Optional. Message is a video, information about the video

§video_note: Option<VideoNote>

Optional. Message is a video note, information about the video message

§voice: Option<Voice>

Optional. Message is a voice message, information about the file

§caption: Option<String>

Optional. Caption for the animation, audio, document, photo, video or voice

§caption_entities: Option<Vec<MessageEntity>>

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption

§contact: Option<Contact>

Optional. Message is a shared contact, information about the contact

§dice: Option<Dice>

Optional. Message is a dice with random value

§game: Option<Game>

Optional. Message is a game, information about the game. More about games »

§poll: Option<Poll>

Optional. Message is a native poll, information about the poll

§venue: Option<Venue>

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set

§location: Option<Location>

Optional. Message is a shared location, information about the location

§new_chat_members: Option<Vec<User>>

Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

§left_chat_member: Option<User>

Optional. A member was removed from the group, information about them (this member may be the bot itself)

§new_chat_title: Option<String>

Optional. A chat title was changed to this value

§new_chat_photo: Option<Vec<PhotoSize>>

Optional. A chat photo was change to this value

§delete_chat_photo: Option<bool>

Optional. Service message: the chat photo was deleted

§group_chat_created: Option<bool>

Optional. Service message: the group has been created

§supergroup_chat_created: Option<bool>

Optional. Service message: the supergroup has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.

§channel_chat_created: Option<bool>

Optional. Service message: the channel has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.

§message_auto_delete_timer_changed: Option<MessageAutoDeleteTimerChanged>

Optional. Service message: auto-delete timer settings changed in the chat

§migrate_to_chat_id: Option<i64>

Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

§migrate_from_chat_id: Option<i64>

Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

§pinned_message: Option<Box<Message>>

Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.

§invoice: Option<Invoice>

Optional. Message is an invoice for a payment, information about the invoice. More about payments »

§successful_payment: Option<SuccessfulPayment>

Optional. Message is a service message about a successful payment, information about the payment. More about payments »

§connected_website: Option<String>

Optional. The domain name of the website on which the user has logged in. More about Telegram Login »

§passport_data: Option<PassportData>

Optional. Telegram Passport data

§proximity_alert_triggered: Option<ProximityAlertTriggered>

Optional. Service message. A user in the chat triggered another user’s proximity alert while sharing Live Location.

§video_chat_scheduled: Option<VideoChatScheduled>

Optional. Service message: video chat scheduled

§video_chat_started: Option<VideoChatStarted>

Optional. Service message: video chat started

§video_chat_ended: Option<VideoChatEnded>

Optional. Service message: video chat ended

§video_chat_participants_invited: Option<VideoChatParticipantsInvited>

Optional. Service message: new participants invited to a video chat

§web_app_data: Option<WebAppData>

Optional. Service message: data sent by a Web App

§reply_markup: Option<InlineKeyboardMarkup>

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.

Implementations§

Source§

impl Message

Source

pub fn new(message_id: i64, date: i64, chat: Box<Chat>) -> Self

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Message

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Message

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Params for T
where T: Serialize,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,