use super::Text;
use crate::types::*;
#[derive(Debug, PartialEq, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum Kind {
Text(Text),
Audio(Audio, Text),
Document(Document, Text),
Game(Game),
Photo(Vec<PhotoSize>, Text, Option<String>),
Sticker(Sticker),
Video(Video, Text, Option<String>),
Voice(Voice, Text),
VideoNote(VideoNote),
Contact(Contact),
Location(Location),
Venue(Venue),
Animation(Animation, Text),
Poll(Poll),
NewChatMembers(Vec<User>),
LeftChatMember(User),
NewChatTitle(String),
NewChatPhoto(Vec<PhotoSize>),
ChatPhotoDeleted,
GroupCreated,
SupergroupCreated,
ChannelCreated,
MigrateTo(chat::Id),
MigrateFrom(chat::Id),
Pinned(Box<Message>),
Invoice(Invoice),
SuccessfulPayment(SuccessfulPayment),
ConnectedWebsite(String),
PassportData(passport::Data),
Unknown,
}
impl Kind {
pub fn is_text(&self) -> bool {
match self {
Kind::Text(..) => true,
_ => false,
}
}
pub fn is_audio(&self) -> bool {
match self {
Kind::Audio(..) => true,
_ => false,
}
}
pub fn is_document(&self) -> bool {
match self {
Kind::Document(..) => true,
_ => false,
}
}
pub fn is_game(&self) -> bool {
match self {
Kind::Game(..) => true,
_ => false,
}
}
pub fn is_photo(&self) -> bool {
match self {
Kind::Photo(..) => true,
_ => false,
}
}
pub fn is_sticker(&self) -> bool {
match self {
Kind::Sticker(..) => true,
_ => false,
}
}
pub fn is_video(&self) -> bool {
match self {
Kind::Video(..) => true,
_ => false,
}
}
pub fn is_voice(&self) -> bool {
match self {
Kind::Voice(..) => true,
_ => false,
}
}
pub fn is_video_note(&self) -> bool {
match self {
Kind::VideoNote(..) => true,
_ => false,
}
}
pub fn is_contact(&self) -> bool {
match self {
Kind::Contact(..) => true,
_ => false,
}
}
pub fn is_location(&self) -> bool {
match self {
Kind::Location(..) => true,
_ => false,
}
}
pub fn is_venue(&self) -> bool {
match self {
Kind::Venue(..) => true,
_ => false,
}
}
pub fn is_animation(&self) -> bool {
match self {
Kind::Animation(..) => true,
_ => false,
}
}
pub fn is_poll(&self) -> bool {
match self {
Kind::Poll(..) => true,
_ => false,
}
}
pub fn is_new_chat_members(&self) -> bool {
match self {
Kind::NewChatMembers(..) => true,
_ => false,
}
}
pub fn is_left_chat_member(&self) -> bool {
match self {
Kind::LeftChatMember(..) => true,
_ => false,
}
}
pub fn is_new_chat_title(&self) -> bool {
match self {
Kind::NewChatTitle(..) => true,
_ => false,
}
}
pub fn is_new_chat_photo(&self) -> bool {
match self {
Kind::NewChatPhoto(..) => true,
_ => false,
}
}
pub fn is_chat_photo_deleted(&self) -> bool {
*self == Kind::ChatPhotoDeleted
}
pub fn is_group_created(&self) -> bool {
*self == Kind::GroupCreated
}
pub fn is_supergroup_created(&self) -> bool {
*self == Kind::SupergroupCreated
}
pub fn is_channel_created(&self) -> bool {
*self == Kind::ChannelCreated
}
pub fn is_migrate_to(&self) -> bool {
match self {
Kind::MigrateTo(..) => true,
_ => false,
}
}
pub fn is_migrate_from(&self) -> bool {
match self {
Kind::MigrateFrom(..) => true,
_ => false,
}
}
pub fn is_pinned(&self) -> bool {
match self {
Kind::Pinned(..) => true,
_ => false,
}
}
pub fn is_invoice(&self) -> bool {
match self {
Kind::Invoice(..) => true,
_ => false,
}
}
pub fn is_successful_payment(&self) -> bool {
match self {
Kind::SuccessfulPayment(..) => true,
_ => false,
}
}
pub fn is_connected_website(&self) -> bool {
match self {
Kind::ConnectedWebsite(..) => true,
_ => false,
}
}
pub fn is_passport_data(&self) -> bool {
match self {
Kind::PassportData(..) => true,
_ => false,
}
}
}