[][src]Enum tbot::types::message::Kind

#[non_exhaustive]
pub enum Kind {
    Text(Text),
    Audio(Box<Audio>, Text),
    Document(Box<Document>, Text),
    Game(Box<Game>),
    Photo(Vec<PhotoSize>, TextOption<String>),
    Sticker(Box<Sticker>),
    Video(Box<Video>, TextOption<String>),
    Voice(VoiceText),
    VideoNote(VideoNote),
    Contact(Contact),
    Location(Location),
    Venue(Venue),
    Animation(Box<Animation>, Text),
    Poll(Poll),
    NewChatMembers(Vec<User>),
    LeftChatMember(User),
    NewChatTitle(String),
    NewChatPhoto(Vec<PhotoSize>),
    ChatPhotoDeleted,
    GroupCreated,
    SupergroupCreated,
    ChannelCreated,
    MigrateTo(Id),
    MigrateFrom(Id),
    Pinned(Box<Message>),
    Invoice(Invoice),
    SuccessfulPayment(Box<SuccessfulPayment>),
    ConnectedWebsite(String),
    PassportData(Data),
    Unknown,
}

Represents kinds of messages.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(Text)

A text message.

Audio(Box<Audio>, Text)

An audio. The second item is the caption.

Document(Box<Document>, Text)

A document. The second item is the caption.

Game(Box<Game>)

An invitation to play a game.

A photo. The second item is the caption, the third one is media_group_id, i.e. this photo belongs to an album with this ID.

Sticker(Box<Sticker>)

A sticker.

Video(Box<Video>, TextOption<String>)

A video. The second item is the caption, the third one is media_group_id, i.e. this photo belongs to an album with this ID.

Voice(VoiceText)

A voice message. The second item is the caption.

VideoNote(VideoNote)

A video note.

Contact(Contact)

A contact.

Location(Location)

A location.

Venue(Venue)

A venue.

Animation(Box<Animation>, Text)

An animation. The second item is the caption.

Poll(Poll)

A poll.

NewChatMembers(Vec<User>)

A service message about new chat members.

LeftChatMember(User)

A service message about a member who left.

NewChatTitle(String)

A service message about the new chat title.

NewChatPhoto(Vec<PhotoSize>)

A service message about the new chat photo.

ChatPhotoDeleted

A service message that the chat photo was deleted.

GroupCreated

A service message that the group was created.

SupergroupCreated

A service message that the supergroup was created.

ChannelCreated

A service message that the channel was created.

MigrateTo(Id)

A service message that the group migrated to a supergroup with this ID.

MigrateFrom(Id)

A service message that the supergroup used to be a group with this ID.

Pinned(Box<Message>)

A service message that this message was pinned.

Invoice(Invoice)

An invoice.

SuccessfulPayment(Box<SuccessfulPayment>)

A service message about a successful payment.

ConnectedWebsite(String)

A connected website.

PassportData(Data)

Passport data.

Unknown

Some unkonwn message kind. Probably means tbot is outdated.

Methods

impl Kind[src]

pub fn is_text(&self) -> bool[src]

Returns true if self is of variant Text.

pub fn expect_text(self) -> Text where
    Self: Debug
[src]

Unwraps the value, yielding the content of Text.

Panics

Panics if the value is not Text, with a panic message including the content of self.

pub fn text(self) -> Option<Text>[src]

Returns Some if self is of variant Text, and None otherwise.

pub fn is_audio(&self) -> bool[src]

Returns true if self is of variant Audio.

pub fn expect_audio(self) -> (Box<Audio>, Text) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Audio.

Panics

Panics if the value is not Audio, with a panic message including the content of self.

pub fn audio(self) -> Option<(Box<Audio>, Text)>[src]

Returns Some if self is of variant Audio, and None otherwise.

pub fn is_document(&self) -> bool[src]

Returns true if self is of variant Document.

pub fn expect_document(self) -> (Box<Document>, Text) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Document.

Panics

Panics if the value is not Document, with a panic message including the content of self.

pub fn document(self) -> Option<(Box<Document>, Text)>[src]

Returns Some if self is of variant Document, and None otherwise.

pub fn is_game(&self) -> bool[src]

Returns true if self is of variant Game.

pub fn expect_game(self) -> Box<Game> where
    Self: Debug
[src]

Unwraps the value, yielding the content of Game.

Panics

Panics if the value is not Game, with a panic message including the content of self.

pub fn game(self) -> Option<Box<Game>>[src]

Returns Some if self is of variant Game, and None otherwise.

pub fn is_photo(&self) -> bool[src]

Returns true if self is of variant Photo.

pub fn expect_photo(self) -> (Vec<PhotoSize>, Text, Option<String>) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Photo.

Panics

Panics if the value is not Photo, with a panic message including the content of self.

pub fn photo(self) -> Option<(Vec<PhotoSize>, Text, Option<String>)>[src]

Returns Some if self is of variant Photo, and None otherwise.

pub fn is_sticker(&self) -> bool[src]

Returns true if self is of variant Sticker.

pub fn expect_sticker(self) -> Box<Sticker> where
    Self: Debug
[src]

Unwraps the value, yielding the content of Sticker.

Panics

Panics if the value is not Sticker, with a panic message including the content of self.

pub fn sticker(self) -> Option<Box<Sticker>>[src]

Returns Some if self is of variant Sticker, and None otherwise.

pub fn is_video(&self) -> bool[src]

Returns true if self is of variant Video.

pub fn expect_video(self) -> (Box<Video>, Text, Option<String>) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Video.

Panics

Panics if the value is not Video, with a panic message including the content of self.

pub fn video(self) -> Option<(Box<Video>, Text, Option<String>)>[src]

Returns Some if self is of variant Video, and None otherwise.

pub fn is_voice(&self) -> bool[src]

Returns true if self is of variant Voice.

pub fn expect_voice(self) -> (Voice, Text) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Voice.

Panics

Panics if the value is not Voice, with a panic message including the content of self.

pub fn voice(self) -> Option<(Voice, Text)>[src]

Returns Some if self is of variant Voice, and None otherwise.

pub fn is_video_note(&self) -> bool[src]

Returns true if self is of variant VideoNote.

pub fn expect_video_note(self) -> VideoNote where
    Self: Debug
[src]

Unwraps the value, yielding the content of VideoNote.

Panics

Panics if the value is not VideoNote, with a panic message including the content of self.

pub fn video_note(self) -> Option<VideoNote>[src]

Returns Some if self is of variant VideoNote, and None otherwise.

pub fn is_contact(&self) -> bool[src]

Returns true if self is of variant Contact.

pub fn expect_contact(self) -> Contact where
    Self: Debug
[src]

Unwraps the value, yielding the content of Contact.

Panics

Panics if the value is not Contact, with a panic message including the content of self.

pub fn contact(self) -> Option<Contact>[src]

Returns Some if self is of variant Contact, and None otherwise.

pub fn is_location(&self) -> bool[src]

Returns true if self is of variant Location.

pub fn expect_location(self) -> Location where
    Self: Debug
[src]

Unwraps the value, yielding the content of Location.

Panics

Panics if the value is not Location, with a panic message including the content of self.

pub fn location(self) -> Option<Location>[src]

Returns Some if self is of variant Location, and None otherwise.

pub fn is_venue(&self) -> bool[src]

Returns true if self is of variant Venue.

pub fn expect_venue(self) -> Venue where
    Self: Debug
[src]

Unwraps the value, yielding the content of Venue.

Panics

Panics if the value is not Venue, with a panic message including the content of self.

pub fn venue(self) -> Option<Venue>[src]

Returns Some if self is of variant Venue, and None otherwise.

pub fn is_animation(&self) -> bool[src]

Returns true if self is of variant Animation.

pub fn expect_animation(self) -> (Box<Animation>, Text) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Animation.

Panics

Panics if the value is not Animation, with a panic message including the content of self.

pub fn animation(self) -> Option<(Box<Animation>, Text)>[src]

Returns Some if self is of variant Animation, and None otherwise.

pub fn is_poll(&self) -> bool[src]

Returns true if self is of variant Poll.

pub fn expect_poll(self) -> Poll where
    Self: Debug
[src]

Unwraps the value, yielding the content of Poll.

Panics

Panics if the value is not Poll, with a panic message including the content of self.

pub fn poll(self) -> Option<Poll>[src]

Returns Some if self is of variant Poll, and None otherwise.

pub fn is_new_chat_members(&self) -> bool[src]

Returns true if self is of variant NewChatMembers.

pub fn expect_new_chat_members(self) -> Vec<User> where
    Self: Debug
[src]

Unwraps the value, yielding the content of NewChatMembers.

Panics

Panics if the value is not NewChatMembers, with a panic message including the content of self.

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

Returns Some if self is of variant NewChatMembers, and None otherwise.

pub fn is_left_chat_member(&self) -> bool[src]

Returns true if self is of variant LeftChatMember.

pub fn expect_left_chat_member(self) -> User where
    Self: Debug
[src]

Unwraps the value, yielding the content of LeftChatMember.

Panics

Panics if the value is not LeftChatMember, with a panic message including the content of self.

pub fn left_chat_member(self) -> Option<User>[src]

Returns Some if self is of variant LeftChatMember, and None otherwise.

pub fn is_new_chat_title(&self) -> bool[src]

Returns true if self is of variant NewChatTitle.

pub fn expect_new_chat_title(self) -> String where
    Self: Debug
[src]

Unwraps the value, yielding the content of NewChatTitle.

Panics

Panics if the value is not NewChatTitle, with a panic message including the content of self.

pub fn new_chat_title(self) -> Option<String>[src]

Returns Some if self is of variant NewChatTitle, and None otherwise.

pub fn is_new_chat_photo(&self) -> bool[src]

Returns true if self is of variant NewChatPhoto.

pub fn expect_new_chat_photo(self) -> Vec<PhotoSize> where
    Self: Debug
[src]

Unwraps the value, yielding the content of NewChatPhoto.

Panics

Panics if the value is not NewChatPhoto, with a panic message including the content of self.

pub fn new_chat_photo(self) -> Option<Vec<PhotoSize>>[src]

Returns Some if self is of variant NewChatPhoto, and None otherwise.

pub fn is_chat_photo_deleted(&self) -> bool[src]

Returns true if self is of variant ChatPhotoDeleted.

pub fn is_group_created(&self) -> bool[src]

Returns true if self is of variant GroupCreated.

pub fn is_supergroup_created(&self) -> bool[src]

Returns true if self is of variant SupergroupCreated.

pub fn is_channel_created(&self) -> bool[src]

Returns true if self is of variant ChannelCreated.

pub fn is_migrate_to(&self) -> bool[src]

Returns true if self is of variant MigrateTo.

pub fn expect_migrate_to(self) -> Id where
    Self: Debug
[src]

Unwraps the value, yielding the content of MigrateTo.

Panics

Panics if the value is not MigrateTo, with a panic message including the content of self.

pub fn migrate_to(self) -> Option<Id>[src]

Returns Some if self is of variant MigrateTo, and None otherwise.

pub fn is_migrate_from(&self) -> bool[src]

Returns true if self is of variant MigrateFrom.

pub fn expect_migrate_from(self) -> Id where
    Self: Debug
[src]

Unwraps the value, yielding the content of MigrateFrom.

Panics

Panics if the value is not MigrateFrom, with a panic message including the content of self.

pub fn migrate_from(self) -> Option<Id>[src]

Returns Some if self is of variant MigrateFrom, and None otherwise.

pub fn is_pinned(&self) -> bool[src]

Returns true if self is of variant Pinned.

pub fn expect_pinned(self) -> Box<Message> where
    Self: Debug
[src]

Unwraps the value, yielding the content of Pinned.

Panics

Panics if the value is not Pinned, with a panic message including the content of self.

pub fn pinned(self) -> Option<Box<Message>>[src]

Returns Some if self is of variant Pinned, and None otherwise.

pub fn is_invoice(&self) -> bool[src]

Returns true if self is of variant Invoice.

pub fn expect_invoice(self) -> Invoice where
    Self: Debug
[src]

Unwraps the value, yielding the content of Invoice.

Panics

Panics if the value is not Invoice, with a panic message including the content of self.

pub fn invoice(self) -> Option<Invoice>[src]

Returns Some if self is of variant Invoice, and None otherwise.

pub fn is_successful_payment(&self) -> bool[src]

Returns true if self is of variant SuccessfulPayment.

pub fn expect_successful_payment(self) -> Box<SuccessfulPayment> where
    Self: Debug
[src]

Unwraps the value, yielding the content of SuccessfulPayment.

Panics

Panics if the value is not SuccessfulPayment, with a panic message including the content of self.

pub fn successful_payment(self) -> Option<Box<SuccessfulPayment>>[src]

Returns Some if self is of variant SuccessfulPayment, and None otherwise.

pub fn is_connected_website(&self) -> bool[src]

Returns true if self is of variant ConnectedWebsite.

pub fn expect_connected_website(self) -> String where
    Self: Debug
[src]

Unwraps the value, yielding the content of ConnectedWebsite.

Panics

Panics if the value is not ConnectedWebsite, with a panic message including the content of self.

pub fn connected_website(self) -> Option<String>[src]

Returns Some if self is of variant ConnectedWebsite, and None otherwise.

pub fn is_passport_data(&self) -> bool[src]

Returns true if self is of variant PassportData.

pub fn expect_passport_data(self) -> Data where
    Self: Debug
[src]

Unwraps the value, yielding the content of PassportData.

Panics

Panics if the value is not PassportData, with a panic message including the content of self.

pub fn passport_data(self) -> Option<Data>[src]

Returns Some if self is of variant PassportData, and None otherwise.

pub fn is_unknown(&self) -> bool[src]

Returns true if self is of variant Unknown.

Trait Implementations

impl Clone for Kind[src]

impl Debug for Kind[src]

impl PartialEq<Kind> for Kind[src]

impl StructuralPartialEq for Kind[src]

Auto Trait Implementations

impl RefUnwindSafe for Kind

impl Send for Kind

impl Sync for Kind

impl Unpin for Kind

impl UnwindSafe for Kind

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.