MessageKind

Enum MessageKind 

Source
pub enum MessageKind {
Show 33 variants Text { text: String, entities: Option<Vec<MessageEntity>>, }, Animation { animation: Animation, document: Document, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Audio { audio: Audio, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Document { document: Document, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Photo { photo: Vec<PhotoSize>, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Sticker { sticker: Sticker, }, Video { video: Video, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, VideoNote { video_note: VideoNote, }, Voice { voice: Voice, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Contact { contact: Contact, }, Dice { dice: Dice, }, Game { game: Game, }, Poll { poll: Poll, }, Venue { venue: Venue, location: Location, }, Location { location: Location, }, NewChatMembers { new_chat_members: Vec<User>, }, LeftChatMember { left_chat_member: User, }, NewChatTitle { new_chat_title: String, }, DeleteChatPhoto { delete_chat_photo: bool, }, GroupChatCreated { group_chat_created: bool, }, SupergroupChatCreated { supergroup_chat_created: bool, }, ChannelChatCreated { channel_chat_created: bool, }, MessageAutoDeleteTimerChanged { message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged, }, GroupMigrated { migrate_to_chat_id: i64, migrate_from_chat_id: i64, }, MessagePinned { pinned_message: Box<Message>, }, Invoice { invoice: Invoice, }, SuccessfulPayment { successful_payment: SuccessfulPayment, }, Login { connected_website: String, passport_data: PassportData, }, ProximityAlertTriggered { proximity_alert_triggered: ProximityAlertTriggered, }, VoiceChatScheduled { voice_chat_scheduled: VoiceChatScheduled, }, VoiceChatStarted { voice_chat_started: VoiceChatStarted, }, VoiceChatEnded { voice_chat_ended: VoiceChatEnded, }, VoiceChatParticipantsInvited { voice_chat_participants_invited: VoiceChatParticipantsInvited, },
}
Expand description

Variants of a message.

Variants§

§

Text

Text message

Fields

§text: String

The actual UTF-8 text of the message, 0-4096 characters

§entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the text

§

Animation

Animation message

Fields

§animation: Animation

Information about the animation. For backward compatibility, when this field is set, the document field will also be set

§document: Document

Information about the file

§caption: Option<String>

Caption for the animation, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

Audio

Audio message

Fields

§audio: Audio

Information about the file

§caption: Option<String>

Caption for the audio, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

Document

General file message

Fields

§document: Document

Information about the file

§caption: Option<String>

Caption for the document, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

Photo

Photo message

Fields

§photo: Vec<PhotoSize>

Available sizes of the photo

§caption: Option<String>

Caption for the photo, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

Sticker

Sticker message

Fields

§sticker: Sticker

Information about the sticker

§

Video

Video message

Fields

§video: Video

Information about the video

§caption: Option<String>

Caption for the video, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

VideoNote

Fields

§video_note: VideoNote

Information about the video message

§

Voice

Voice message

Fields

§voice: Voice

Information about the file

§caption: Option<String>

Caption for the voice, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

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

§

Contact

Shared contact

Fields

§contact: Contact

Information about the contact

§

Dice

Fields

§dice: Dice
§

Game

Fields

§game: Game

Information about the game. More about games »

§

Poll

Native Poll

Fields

§poll: Poll

Information about the poll

§

Venue

Venue message

Fields

§venue: Venue

Information about the venue. For backward compatibility, when this field is set, the location field will also be set

§location: Location

Information about the location

§

Location

Shared location

Fields

§location: Location

Information about the location

§

NewChatMembers

New chat members message

Fields

§new_chat_members: Vec<User>

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

§

LeftChatMember

Chat members leave message

Fields

§left_chat_member: User

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

§

NewChatTitle

Chat title change message

Fields

§new_chat_title: String

A chat title was changed to this value

§

DeleteChatPhoto

Service message: the chat photo was deleted

Fields

§delete_chat_photo: bool

Always true

§

GroupChatCreated

Service message: the group has been created

Fields

§group_chat_created: bool

Always true

§

SupergroupChatCreated

Service message: the supergroup has been created. This variant 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.

Fields

§supergroup_chat_created: bool

Always true

§

ChannelChatCreated

Service message: the channel has been created. This variant 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.

Fields

§channel_chat_created: bool

Always true

§

MessageAutoDeleteTimerChanged

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

Fields

§message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged
§

GroupMigrated

Group migration message

Fields

§migrate_to_chat_id: i64

The group has been migrated to a supergroup with the specified identifier.

§migrate_from_chat_id: i64

The supergroup has been migrated from a group with the specified identifier.

§

MessagePinned

Pinned message

Fields

§pinned_message: Box<Message>

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

Invoice for a payment

Fields

§invoice: Invoice

Information about the invoice. More about payments »

§

SuccessfulPayment

Service message about a successful payment

Fields

§successful_payment: SuccessfulPayment

Information about the payment. More about payments »

§

Login

Login message.

Fields

§connected_website: String

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

§passport_data: PassportData

Telegram Passport data

§

ProximityAlertTriggered

Service message: a user in the chat triggered another user’s proximity alert while sharing Live Location

Fields

§proximity_alert_triggered: ProximityAlertTriggered
§

VoiceChatScheduled

Service message: voice chat scheduled

Fields

§voice_chat_scheduled: VoiceChatScheduled
§

VoiceChatStarted

Service message: voice chat started

Fields

§voice_chat_started: VoiceChatStarted
§

VoiceChatEnded

Service message: voice chat ended

Fields

§voice_chat_ended: VoiceChatEnded
§

VoiceChatParticipantsInvited

Service message: new participants invited to a voice chat

Fields

§voice_chat_participants_invited: VoiceChatParticipantsInvited

Implementations§

Source§

impl MessageKind

Source

pub fn text(&self) -> Option<&str>

Source

pub fn entities(&self) -> Option<&[MessageEntity]>

Source

pub fn animation(&self) -> Option<&Animation>

Source

pub fn document(&self) -> Option<&Document>

Source

pub fn caption(&self) -> Option<&str>

Source

pub fn caption_entities(&self) -> Option<&[MessageEntity]>

Source

pub fn audio(&self) -> Option<&Audio>

Source

pub fn photo(&self) -> Option<&[PhotoSize]>

Source

pub fn sticker(&self) -> Option<&Sticker>

Source

pub fn video(&self) -> Option<&Video>

Source

pub fn video_note(&self) -> Option<&VideoNote>

Source

pub fn voice(&self) -> Option<&Voice>

Source

pub fn contact(&self) -> Option<&Contact>

Source

pub fn dice(&self) -> Option<&Dice>

Source

pub fn game(&self) -> Option<&Game>

Source

pub fn poll(&self) -> Option<&Poll>

Source

pub fn venue(&self) -> Option<&Venue>

Source

pub fn location(&self) -> Option<&Location>

Source

pub fn new_chat_members(&self) -> Option<&[User]>

Source

pub fn left_chat_member(&self) -> Option<&User>

Source

pub fn new_chat_title(&self) -> Option<&str>

Source

pub fn message_auto_delete_timer_changed( &self, ) -> Option<&MessageAutoDeleteTimerChanged>

Source

pub fn migrate_to_chat_id(&self) -> Option<i64>

Source

pub fn migrate_from_chat_id(&self) -> Option<i64>

Source

pub fn pinned_message(&self) -> Option<&Message>

Source

pub fn invoice(&self) -> Option<&Invoice>

Source

pub fn successful_payment(&self) -> Option<&SuccessfulPayment>

Source

pub fn connected_website(&self) -> Option<&str>

Source

pub fn passport_data(&self) -> Option<&PassportData>

Source

pub fn proximity_alert_triggered(&self) -> Option<&ProximityAlertTriggered>

Source

pub fn voice_chat_scheduled(&self) -> Option<&VoiceChatScheduled>

Source

pub fn voice_chat_started(&self) -> Option<&VoiceChatStarted>

Source

pub fn voice_chat_ended(&self) -> Option<&VoiceChatEnded>

Source

pub fn voice_chat_participants_invited( &self, ) -> Option<&VoiceChatParticipantsInvited>

Source

pub fn is_text(&self) -> bool

Source

pub fn is_animation(&self) -> bool

Source

pub fn is_audio(&self) -> bool

Source

pub fn is_document(&self) -> bool

Source

pub fn is_photo(&self) -> bool

Source

pub fn is_sticker(&self) -> bool

Source

pub fn is_video(&self) -> bool

Source

pub fn is_video_note(&self) -> bool

Source

pub fn is_voice(&self) -> bool

Source

pub fn is_contact(&self) -> bool

Source

pub fn is_dice(&self) -> bool

Source

pub fn is_game(&self) -> bool

Source

pub fn is_poll(&self) -> bool

Source

pub fn is_venue(&self) -> bool

Source

pub fn is_location(&self) -> bool

Source

pub fn is_new_chat_members(&self) -> bool

Source

pub fn is_left_chat_member(&self) -> bool

Source

pub fn is_new_chat_title(&self) -> bool

Source

pub fn is_delete_chat_photo(&self) -> bool

Source

pub fn is_group_chat_created(&self) -> bool

Source

pub fn is_supergroup_chat_created(&self) -> bool

Source

pub fn is_channel_chat_created(&self) -> bool

Source

pub fn is_group_migrated(&self) -> bool

Source

pub fn is_message_pinned(&self) -> bool

Source

pub fn is_invoice(&self) -> bool

Source

pub fn is_login(&self) -> bool

Source

pub fn is_proximity_alert_triggered(&self) -> bool

Source

pub fn is_voice_chat_scheduled(&self) -> bool

Source

pub fn is_voice_chat_started(&self) -> bool

Source

pub fn is_voice_chat_ended(&self) -> bool

Source

pub fn is_voice_chat_participants_invited(&self) -> bool

Trait Implementations§

Source§

impl Debug for MessageKind

Source§

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

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

impl<'de> Deserialize<'de> for MessageKind

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>,