#[non_exhaustive]
pub enum Kind {
Show 37 variants
Text(Text),
Audio {
audio: Box<Audio>,
caption: Text,
media_group_id: Option<String>,
},
Document {
document: Box<Document>,
caption: Text,
media_group_id: Option<String>,
},
Dice(Dice),
Game(Box<Game>),
Photo {
photo: Vec<PhotoSize>,
caption: Text,
media_group_id: Option<String>,
},
Sticker(Box<Sticker>),
Video {
video: Box<Video>,
caption: Text,
media_group_id: Option<String>,
},
Voice {
voice: Voice,
caption: Text,
},
VideoNote(VideoNote),
Contact(Contact),
Location(Location),
Venue(Venue),
Animation {
animation: Box<Animation>,
caption: 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),
ProximityAlert(ProximityAlert),
VoiceChatStarted,
VoiceChatParticipantsInvited(ParticipantsInvited),
VoiceChatEnded(Ended),
VoiceChatScheduled(Scheduled),
AutoDeleteTimerChanged(AutoDeleteTimerChanged),
Unknown,
}
Expand description
Represents kinds of messages.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(Text)
A text message.
Audio
Fields
The audio’s caption.
An audio.
Document
Fields
The document’s caption.
A document.
Dice(Dice)
A dice.
Game(Box<Game>)
An invitation to play a game.
Photo
Fields
The photo’s caption.
A photo.
Sticker(Box<Sticker>)
A sticker.
Video
Fields
The video’s caption.
A video.
Voice
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
An animation.
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.
ProximityAlert(ProximityAlert)
A proximity alert.
VoiceChatStarted
A voice chat was started.
VoiceChatParticipantsInvited(ParticipantsInvited)
Participants were invited to a voice chat.
VoiceChatEnded(Ended)
A voice chat was ended.
VoiceChatScheduled(Scheduled)
A voice chat was scheduled.
AutoDeleteTimerChanged(AutoDeleteTimerChanged)
The auto-delete time was changed.
Unknown
Some unkonwn message kind. Probably means tbot
is outdated.
Implementations§
source§impl Kind
impl Kind
sourcepub fn expect_text(self) -> Textwhere
Self: Debug,
pub fn expect_text(self) -> Textwhere
Self: Debug,
sourcepub fn is_document(&self) -> bool
pub fn is_document(&self) -> bool
Returns true
if self
is of variant Document
.
sourcepub fn expect_dice(self) -> Dicewhere
Self: Debug,
pub fn expect_dice(self) -> Dicewhere
Self: Debug,
sourcepub fn expect_game(self) -> Box<Game>where
Self: Debug,
pub fn expect_game(self) -> Box<Game>where
Self: Debug,
sourcepub fn game(self) -> Option<Box<Game>>
pub fn game(self) -> Option<Box<Game>>
Returns Some
if self
is of variant Game
, and None
otherwise.
sourcepub fn is_sticker(&self) -> bool
pub fn is_sticker(&self) -> bool
Returns true
if self
is of variant Sticker
.
sourcepub fn expect_sticker(self) -> Box<Sticker>where
Self: Debug,
pub fn expect_sticker(self) -> Box<Sticker>where
Self: Debug,
sourcepub fn sticker(self) -> Option<Box<Sticker>>
pub fn sticker(self) -> Option<Box<Sticker>>
Returns Some
if self
is of variant Sticker
, and None
otherwise.
sourcepub fn is_video_note(&self) -> bool
pub fn is_video_note(&self) -> bool
Returns true
if self
is of variant VideoNote
.
sourcepub fn expect_video_note(self) -> VideoNotewhere
Self: Debug,
pub fn expect_video_note(self) -> VideoNotewhere
Self: Debug,
sourcepub fn video_note(self) -> Option<VideoNote>
pub fn video_note(self) -> Option<VideoNote>
Returns Some
if self
is of variant VideoNote
, and None
otherwise.
sourcepub fn is_contact(&self) -> bool
pub fn is_contact(&self) -> bool
Returns true
if self
is of variant Contact
.
sourcepub fn expect_contact(self) -> Contactwhere
Self: Debug,
pub fn expect_contact(self) -> Contactwhere
Self: Debug,
sourcepub fn contact(self) -> Option<Contact>
pub fn contact(self) -> Option<Contact>
Returns Some
if self
is of variant Contact
, and None
otherwise.
sourcepub fn is_location(&self) -> bool
pub fn is_location(&self) -> bool
Returns true
if self
is of variant Location
.
sourcepub fn expect_location(self) -> Locationwhere
Self: Debug,
pub fn expect_location(self) -> Locationwhere
Self: Debug,
sourcepub fn location(self) -> Option<Location>
pub fn location(self) -> Option<Location>
Returns Some
if self
is of variant Location
, and None
otherwise.
sourcepub fn expect_venue(self) -> Venuewhere
Self: Debug,
pub fn expect_venue(self) -> Venuewhere
Self: Debug,
sourcepub fn venue(self) -> Option<Venue>
pub fn venue(self) -> Option<Venue>
Returns Some
if self
is of variant Venue
, and None
otherwise.
sourcepub fn is_animation(&self) -> bool
pub fn is_animation(&self) -> bool
Returns true
if self
is of variant Animation
.
sourcepub fn expect_poll(self) -> Pollwhere
Self: Debug,
pub fn expect_poll(self) -> Pollwhere
Self: Debug,
sourcepub fn is_new_chat_members(&self) -> bool
pub fn is_new_chat_members(&self) -> bool
Returns true
if self
is of variant NewChatMembers
.
sourcepub fn expect_new_chat_members(self) -> Vec<User>where
Self: Debug,
pub fn expect_new_chat_members(self) -> Vec<User>where
Self: Debug,
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
.
sourcepub fn new_chat_members(self) -> Option<Vec<User>>
pub fn new_chat_members(self) -> Option<Vec<User>>
Returns Some
if self
is of variant NewChatMembers
, and None
otherwise.
sourcepub fn is_left_chat_member(&self) -> bool
pub fn is_left_chat_member(&self) -> bool
Returns true
if self
is of variant LeftChatMember
.
sourcepub fn expect_left_chat_member(self) -> Userwhere
Self: Debug,
pub fn expect_left_chat_member(self) -> Userwhere
Self: Debug,
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
.
sourcepub fn left_chat_member(self) -> Option<User>
pub fn left_chat_member(self) -> Option<User>
Returns Some
if self
is of variant LeftChatMember
, and None
otherwise.
sourcepub fn is_new_chat_title(&self) -> bool
pub fn is_new_chat_title(&self) -> bool
Returns true
if self
is of variant NewChatTitle
.
sourcepub fn expect_new_chat_title(self) -> Stringwhere
Self: Debug,
pub fn expect_new_chat_title(self) -> Stringwhere
Self: Debug,
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
.
sourcepub fn new_chat_title(self) -> Option<String>
pub fn new_chat_title(self) -> Option<String>
Returns Some
if self
is of variant NewChatTitle
, and None
otherwise.
sourcepub fn is_new_chat_photo(&self) -> bool
pub fn is_new_chat_photo(&self) -> bool
Returns true
if self
is of variant NewChatPhoto
.
sourcepub fn expect_new_chat_photo(self) -> Vec<PhotoSize>where
Self: Debug,
pub fn expect_new_chat_photo(self) -> Vec<PhotoSize>where
Self: Debug,
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
.
sourcepub fn new_chat_photo(self) -> Option<Vec<PhotoSize>>
pub fn new_chat_photo(self) -> Option<Vec<PhotoSize>>
Returns Some
if self
is of variant NewChatPhoto
, and None
otherwise.
sourcepub fn is_chat_photo_deleted(&self) -> bool
pub fn is_chat_photo_deleted(&self) -> bool
Returns true
if self
is of variant ChatPhotoDeleted
.
sourcepub fn is_group_created(&self) -> bool
pub fn is_group_created(&self) -> bool
Returns true
if self
is of variant GroupCreated
.
sourcepub fn is_supergroup_created(&self) -> bool
pub fn is_supergroup_created(&self) -> bool
Returns true
if self
is of variant SupergroupCreated
.
sourcepub fn is_channel_created(&self) -> bool
pub fn is_channel_created(&self) -> bool
Returns true
if self
is of variant ChannelCreated
.
sourcepub fn is_migrate_to(&self) -> bool
pub fn is_migrate_to(&self) -> bool
Returns true
if self
is of variant MigrateTo
.
sourcepub fn expect_migrate_to(self) -> Idwhere
Self: Debug,
pub fn expect_migrate_to(self) -> Idwhere
Self: Debug,
sourcepub fn migrate_to(self) -> Option<Id>
pub fn migrate_to(self) -> Option<Id>
Returns Some
if self
is of variant MigrateTo
, and None
otherwise.
sourcepub fn is_migrate_from(&self) -> bool
pub fn is_migrate_from(&self) -> bool
Returns true
if self
is of variant MigrateFrom
.
sourcepub fn expect_migrate_from(self) -> Idwhere
Self: Debug,
pub fn expect_migrate_from(self) -> Idwhere
Self: Debug,
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
.
sourcepub fn migrate_from(self) -> Option<Id>
pub fn migrate_from(self) -> Option<Id>
Returns Some
if self
is of variant MigrateFrom
, and None
otherwise.
sourcepub fn expect_pinned(self) -> Box<Message>where
Self: Debug,
pub fn expect_pinned(self) -> Box<Message>where
Self: Debug,
sourcepub fn pinned(self) -> Option<Box<Message>>
pub fn pinned(self) -> Option<Box<Message>>
Returns Some
if self
is of variant Pinned
, and None
otherwise.
sourcepub fn is_invoice(&self) -> bool
pub fn is_invoice(&self) -> bool
Returns true
if self
is of variant Invoice
.
sourcepub fn expect_invoice(self) -> Invoicewhere
Self: Debug,
pub fn expect_invoice(self) -> Invoicewhere
Self: Debug,
sourcepub fn invoice(self) -> Option<Invoice>
pub fn invoice(self) -> Option<Invoice>
Returns Some
if self
is of variant Invoice
, and None
otherwise.
sourcepub fn is_successful_payment(&self) -> bool
pub fn is_successful_payment(&self) -> bool
Returns true
if self
is of variant SuccessfulPayment
.
sourcepub fn expect_successful_payment(self) -> Box<SuccessfulPayment>where
Self: Debug,
pub fn expect_successful_payment(self) -> Box<SuccessfulPayment>where
Self: Debug,
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
.
sourcepub fn successful_payment(self) -> Option<Box<SuccessfulPayment>>
pub fn successful_payment(self) -> Option<Box<SuccessfulPayment>>
Returns Some
if self
is of variant SuccessfulPayment
, and None
otherwise.
sourcepub fn is_connected_website(&self) -> bool
pub fn is_connected_website(&self) -> bool
Returns true
if self
is of variant ConnectedWebsite
.
sourcepub fn expect_connected_website(self) -> Stringwhere
Self: Debug,
pub fn expect_connected_website(self) -> Stringwhere
Self: Debug,
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
.
sourcepub fn connected_website(self) -> Option<String>
pub fn connected_website(self) -> Option<String>
Returns Some
if self
is of variant ConnectedWebsite
, and None
otherwise.
sourcepub fn is_passport_data(&self) -> bool
pub fn is_passport_data(&self) -> bool
Returns true
if self
is of variant PassportData
.
sourcepub fn expect_passport_data(self) -> Datawhere
Self: Debug,
pub fn expect_passport_data(self) -> Datawhere
Self: Debug,
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
.
sourcepub fn passport_data(self) -> Option<Data>
pub fn passport_data(self) -> Option<Data>
Returns Some
if self
is of variant PassportData
, and None
otherwise.
sourcepub fn is_proximity_alert(&self) -> bool
pub fn is_proximity_alert(&self) -> bool
Returns true
if self
is of variant ProximityAlert
.
sourcepub fn expect_proximity_alert(self) -> ProximityAlertwhere
Self: Debug,
pub fn expect_proximity_alert(self) -> ProximityAlertwhere
Self: Debug,
Unwraps the value, yielding the content of ProximityAlert
.
Panics
Panics if the value is not ProximityAlert
, with a panic message including the content of self
.
sourcepub fn proximity_alert(self) -> Option<ProximityAlert>
pub fn proximity_alert(self) -> Option<ProximityAlert>
Returns Some
if self
is of variant ProximityAlert
, and None
otherwise.
sourcepub fn is_voice_chat_started(&self) -> bool
pub fn is_voice_chat_started(&self) -> bool
Returns true
if self
is of variant VoiceChatStarted
.
sourcepub fn is_voice_chat_participants_invited(&self) -> bool
pub fn is_voice_chat_participants_invited(&self) -> bool
Returns true
if self
is of variant VoiceChatParticipantsInvited
.
sourcepub fn expect_voice_chat_participants_invited(self) -> ParticipantsInvitedwhere
Self: Debug,
pub fn expect_voice_chat_participants_invited(self) -> ParticipantsInvitedwhere
Self: Debug,
Unwraps the value, yielding the content of VoiceChatParticipantsInvited
.
Panics
Panics if the value is not VoiceChatParticipantsInvited
, with a panic message including the content of self
.
sourcepub fn voice_chat_participants_invited(self) -> Option<ParticipantsInvited>
pub fn voice_chat_participants_invited(self) -> Option<ParticipantsInvited>
Returns Some
if self
is of variant VoiceChatParticipantsInvited
, and None
otherwise.
sourcepub fn is_voice_chat_ended(&self) -> bool
pub fn is_voice_chat_ended(&self) -> bool
Returns true
if self
is of variant VoiceChatEnded
.
sourcepub fn expect_voice_chat_ended(self) -> Endedwhere
Self: Debug,
pub fn expect_voice_chat_ended(self) -> Endedwhere
Self: Debug,
Unwraps the value, yielding the content of VoiceChatEnded
.
Panics
Panics if the value is not VoiceChatEnded
, with a panic message including the content of self
.
sourcepub fn voice_chat_ended(self) -> Option<Ended>
pub fn voice_chat_ended(self) -> Option<Ended>
Returns Some
if self
is of variant VoiceChatEnded
, and None
otherwise.
sourcepub fn is_voice_chat_scheduled(&self) -> bool
pub fn is_voice_chat_scheduled(&self) -> bool
Returns true
if self
is of variant VoiceChatScheduled
.
sourcepub fn expect_voice_chat_scheduled(self) -> Scheduledwhere
Self: Debug,
pub fn expect_voice_chat_scheduled(self) -> Scheduledwhere
Self: Debug,
Unwraps the value, yielding the content of VoiceChatScheduled
.
Panics
Panics if the value is not VoiceChatScheduled
, with a panic message including the content of self
.
sourcepub fn voice_chat_scheduled(self) -> Option<Scheduled>
pub fn voice_chat_scheduled(self) -> Option<Scheduled>
Returns Some
if self
is of variant VoiceChatScheduled
, and None
otherwise.
sourcepub fn is_auto_delete_timer_changed(&self) -> bool
pub fn is_auto_delete_timer_changed(&self) -> bool
Returns true
if self
is of variant AutoDeleteTimerChanged
.
sourcepub fn expect_auto_delete_timer_changed(self) -> AutoDeleteTimerChangedwhere
Self: Debug,
pub fn expect_auto_delete_timer_changed(self) -> AutoDeleteTimerChangedwhere
Self: Debug,
Unwraps the value, yielding the content of AutoDeleteTimerChanged
.
Panics
Panics if the value is not AutoDeleteTimerChanged
, with a panic message including the content of self
.
sourcepub fn auto_delete_timer_changed(self) -> Option<AutoDeleteTimerChanged>
pub fn auto_delete_timer_changed(self) -> Option<AutoDeleteTimerChanged>
Returns Some
if self
is of variant AutoDeleteTimerChanged
, and None
otherwise.
sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true
if self
is of variant Unknown
.