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