Message

Struct Message 

Source
pub struct Message {
Show 18 fields pub message_id: i64, pub from: Option<User>, pub sender_chat: Option<Chat>, pub date: u64, pub chat: Chat, pub forward_from: Option<User>, pub forward_from_chat: Option<Chat>, pub forward_from_message_id: Option<i64>, pub forward_signature: Option<String>, pub forward_sender_name: Option<String>, pub forward_date: Option<u64>, pub reply_to_message: Option<Box<Message>>, pub via_bot: Option<User>, pub edit_date: Option<u64>, pub media_group_id: Option<String>, pub author_signature: Option<String>, pub kind: MessageKind, 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>

Sender, empty for messages sent to channels

§sender_chat: Option<Chat>

Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group

§date: u64

Date the message was sent in Unix time

§chat: Chat

Conversation the message belongs to

§forward_from: Option<User>

For forwarded messages, sender of the original message

§forward_from_chat: Option<Chat>

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

§forward_from_message_id: Option<i64>

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

§forward_signature: Option<String>

For messages forwarded from channels, signature of the post author if present

§forward_sender_name: Option<String>

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

§forward_date: Option<u64>

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

§reply_to_message: Option<Box<Message>>

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>

Bot through which the message was sent

§edit_date: Option<u64>

Date the message was last edited in Unix time

§media_group_id: Option<String>

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

§author_signature: Option<String>

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

§kind: MessageKind

Additional information about the message.

§reply_markup: Option<InlineKeyboardMarkup>

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

Implementations§

Source§

impl Message

Source

pub fn reply_text(&self, text: impl Into<String>) -> SendMessage

Source

pub fn forward_to(&self, chat_id: impl Into<ChatId>) -> ForwardMessage

Source

pub fn copy_to(&self, chat_id: impl Into<ChatId>) -> CopyMessage

Source

pub fn pin(&self) -> PinChatMessage

Source

pub fn unpin(&self) -> UnpinChatMessage

Source

pub fn edit_text(&self, text: impl Into<String>) -> EditMessageText

Source

pub fn remove_caption(&self) -> EditMessageCaption

Source

pub fn edit_caption(&self, caption: impl Into<String>) -> EditMessageCaption

Source

pub fn edit_media(&self, media: impl Into<InputMedia>) -> EditMessageMedia

Source

pub fn remove_reply_markup(&self) -> EditMessageReplyMarkup

Source

pub fn edit_reply_markup( &self, reply_markup: impl Into<InlineKeyboardMarkup>, ) -> EditMessageReplyMarkup

Source

pub fn stop_poll(&self) -> StopPoll

Source

pub fn delete(&self) -> DeleteMessage

Trait Implementations§

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

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,