telers 1.0.0-beta.2

An asynchronous framework for Telegram Bot API written in Rust
Documentation
//! Filters are main part of the library used to filter incoming updates and allow call handlers by their data
//! (text, chat, user, command, state, db, etc.) and other conditions.
//!
//! [`Filter`] is a trait that accepts [`Request`] and returns `true` if the filter passes, otherwise `false`.
//! You can use [`Filter`] trait to create your own filters or use one of the ready-made implementations.
//! Most likely you will have to write your filters, so we recommend you to check out the `examples/text_case_filter` to see how to create your own filters
//! and check ready-made implementations.
//!
//! Filters can be combined with logical operators [`And`] and [`Or`] and inverted with [`Invert`].
//! Each filter has a method [`Filter::invert`], [`Filter::and`] and [`Filter::or`] to create [`Invert`], [`And`] and [`Or`] filters respectively.
//!
//! Ready-made implementations:
//! * [`ChatMemberUpdated`]:
//!   Filter for checking chat member status updates.
//!   Allows matching transitions between old and new [`ChatMemberType`].
//!
//!   You can specify only the new status or both (old and new) to match an exact transition.
//!   If the old status is not specified, the filter will match any transition to the given new status.
//!
//!   Created with `new` and can be further restricted by specifying
//!   the old status via `old`.
//! * [`SmartFilter`]:
//!   Filter for most common cases.
//!   Used to check if the update meets the necessary conditions.
//! * [`ChatType`]:
//!   Filter for checking the type of chat.
//!   Usually used with [`ChatTypeEnum`] (or its string representation) to check the type of chat.
//!   Creates with `one` or `many` methods.
//! * [`Command`]:
//!   This filter checks if the message is a command.
//!   Filter accepts [`command pattern type`] that represents a command pattern type for verification,
//!   for example, text, [`BotCommand`] (just alias to text of command) or [`Regex`].
//!   You can create a filter with `new` method with transferring all necessary data at once, or use [`CommandBuilder`] to create a filter step by step.
//!   Instead of [`CommandBuilder`] you can use [`Command`] `one`, `one_with_prefix`, `many`, `many_with_prefix` methods.
//! * [`MessageType`]:
//!   Filter for checking the type of the message content.
//!   Usually used with [`enums::MessageType`] (or its string representation) to check the type of content.
//!   Creates with `one` or `many` methods.
//! * [`State`]:
//!   Filter for checking the state of the user/chat/etc.
//!   Filter accepts a state mode represented by [`State`] variants,
//!   for example, equal, any or none.
//!   You can create a filter with `one` or `many` if you want to check the state with the exact value
//!   or use `any` or `none` if you want to check the state with any value or without state, respectively.
//! * [`Text`]:
//!   This filter checks if the text matches the specified pattern.
//!   Gets the text from the update: the text of the message, the text of the inline query, the data of the callback query, etc.
//!   Filter accepts [`text pattern type`] that represents a text pattern type to check for equality, so you can use [`Regex`] or [`Cow`] to check the text.
//!   You can create a filter with `one` or `many` if you want to check the text with the exact value.
//!   If you want to check the text with `contains`, `starts_with` or `ends_with` methods that accept only [`Cow`],
//!   you can create a filter with `contains_single`, `contains`, `starts_with_single`, `starts_with`, `ends_with_single`, or `ends_with` methods,
//!   or use [`TextBuilder`] to create a filter step by step.
//! * [`User`]:
//!   Filter for checking the user.
//!   This filter checks if the user username, first name, last name, language code or ID is equal to one of the specified.
//!   You can create a filter with `new` method with transferring all necessary data at once, or use [`UserBuilder`] to create a filter step by step.
//!   Instead of [`UserBuilder`] you can use [`User`] `username`, `usernames`, `first_name`, `first_names`, `last_name`, `last_names`,
//!   `language_code`, `language_codes`, `id` or `ids` methods.
//!   This filter checks user data step by step using the logical operator `or`,
//!   so if at least one check is successful, the filter will return the value `true`.
//!
//! [`Cow`]: std::borrow::Cow
//! [`Regex`]: regex::Regex
//! [`ChatTypeEnum`]: telers::enums::ChatType
//! [`enums::MessageType`]: telers::enums::MessageType
//! [`BotCommand`]: telers::types::BotCommand
//! [`Regex`]: regex::Regex
//! [`Request`]: telers::Request
//! [`context`]: telers::context::Context
//! [`command pattern type`]: command::PatternType
//! [`text pattern type`]: text::PatternType

pub mod base;
pub mod chat_member_updated;
pub mod chat_type;
pub mod command;
pub mod logical;
pub mod message_type;
pub mod smart;
pub mod state;
pub mod text;
pub mod user;

pub use base::{Filter, FilterResult};
pub use chat_member_updated::ChatMemberUpdated;
pub use chat_type::ChatType;
pub use command::{Builder as CommandBuilder, Command, CommandObject};
pub use logical::{And, Invert, Or};
pub use message_type::MessageType;
pub use smart::SmartFilter;
pub use state::State;
pub use text::{Builder as TextBuilder, Text};
pub use user::{Builder as UserBuilder, User};