MessageKind

Enum MessageKind 

Source
pub enum MessageKind {
Show 23 variants Text { data: String, entities: Vec<MessageEntity>, }, Audio { data: Audio, }, Document { data: Document, caption: Option<String>, }, Photo { data: Vec<PhotoSize>, caption: Option<String>, media_group_id: Option<String>, }, Sticker { data: Sticker, }, Video { data: Video, caption: Option<String>, media_group_id: Option<String>, }, Voice { data: Voice, }, VideoNote { data: VideoNote, }, Contact { data: Contact, }, Location { data: Location, }, Poll { data: Poll, }, Venue { data: Venue, }, NewChatMembers { data: Vec<User>, }, LeftChatMember { data: User, }, NewChatTitle { data: String, }, NewChatPhoto { data: Vec<PhotoSize>, }, DeleteChatPhoto, GroupChatCreated, SupergroupChatCreated, ChannelChatCreated, MigrateToChatId { data: i64, }, MigrateFromChatId { data: i64, }, PinnedMessage { data: Box<MessageOrChannelPost>, }, // some variants omitted
}
Expand description

Kind of the message.

Variants§

§

Text

Text message.

Fields

§data: String

Actual UTF-8 text of the message, 0-4096 characters.

§entities: Vec<MessageEntity>

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

§

Audio

Message is an audio file.

Fields

§data: Audio

Information about the file.

§

Document

Message is a general file.

Fields

§data: Document

Information about the file.

§caption: Option<String>

Caption for the document, 0-200 characters.

§

Photo

Message is a photo.

Fields

§data: Vec<PhotoSize>

Available sizes of the photo.

§caption: Option<String>

Caption for the photo, 0-200 characters.

§media_group_id: Option<String>

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

§

Sticker

Message is a sticker.

Fields

§data: Sticker

Information about the sticker.

§

Video

Message is a video.

Fields

§data: Video

Information about the video.

§caption: Option<String>

Caption for the video, 0-200 characters.

§media_group_id: Option<String>

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

§

Voice

Message is a voice message.

Fields

§data: Voice

Information about the file.

§

VideoNote

Message is a video note.

Fields

§data: VideoNote

Information about the file.

§

Contact

Message is a shared contact.

Fields

§data: Contact

Information about the contact.

§

Location

Message is a shared location.

Fields

§data: Location

Information about the location.

§

Poll

Message is a poll.

Fields

§data: Poll

Information about the poll.

§

Venue

Message is a venue.

Fields

§data: Venue

Information about the venue.

§

NewChatMembers

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

Fields

§data: Vec<User>

Information about user (this member may be the bot itself).

§

LeftChatMember

A member was removed from the group.

Fields

§data: User

Information about user (this member may be the bot itself).

§

NewChatTitle

New chat title.

Fields

§data: String

A chat title was changed to this value.

§

NewChatPhoto

New chat photo.

Fields

§data: Vec<PhotoSize>

A chat photo was change to this value.

§

DeleteChatPhoto

Service message: the chat photo was deleted.

§

GroupChatCreated

Service message: the group has been created.

§

SupergroupChatCreated

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.

§

ChannelChatCreated

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.

§

MigrateToChatId

The group has been migrated to a supergroup.

Fields

§data: i64

Supergroup chat identifier.

§

MigrateFromChatId

The supergroup has been migrated from a group.

Fields

§data: i64

Group chat identifier.

§

PinnedMessage

Specified message was pinned.

Trait Implementations§

Source§

impl Clone for MessageKind

Source§

fn clone(&self) -> MessageKind

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 MessageKind

Source§

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

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

impl MessageGetFiles for MessageKind

Source§

fn get_files<'a>(&'a self) -> Option<Vec<GetFile>>

Obtain files from a message if available.
Source§

impl MessageText for MessageKind

Source§

fn text<'a>(&'a self) -> Option<String>

Obtain text from a message if available.
Source§

impl PartialEq for MessageKind

Source§

fn eq(&self, other: &MessageKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for MessageKind

Source§

fn partial_cmp(&self, other: &MessageKind) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for MessageKind

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