@ -19,6 +19,7 @@ use super::{
|
||||
basic::{
|
||||
currency_converter::{CurrencyConverter, CurrencyTextFilter},
|
||||
get_chat_id::GetChatId,
|
||||
get_user_id::GetUserId,
|
||||
help::Help,
|
||||
notify_all::NotifyAll,
|
||||
time_converter::TimeConverter,
|
||||
@ -97,6 +98,7 @@ async fn handle_with_log(handler: Box<dyn Handler>, client: Client, update_data:
|
||||
/// and spawns correcsponding handlers.
|
||||
///
|
||||
/// Also, every available handler is defined here.
|
||||
#[allow(clippy::too_many_lines)]
|
||||
async fn run(args: BotConfig, client: Client) -> anyhow::Result<()> {
|
||||
let me = client.get_me().await?;
|
||||
let handlers: Vec<FilteredHandler> = vec![
|
||||
@ -118,6 +120,11 @@ async fn run(args: BotConfig, client: Client) -> anyhow::Result<()> {
|
||||
.add_filter(ExcludedChatsFilter(args.excluded_chats.clone()))
|
||||
.add_filter(TextFilter(&[".cid"], TextMatchMethod::Matches))
|
||||
.add_filter(OnlyFromId(me.id())),
|
||||
// Get user id.
|
||||
FilteredHandler::new(GetUserId)
|
||||
.add_filter(SilentFilter)
|
||||
.add_filter(MessageDirectionFilter(MessageDirection::Outgoing))
|
||||
.add_filter(TextFilter(&[".uid"], TextMatchMethod::Matches)),
|
||||
// Make бля fun again.
|
||||
FilteredHandler::new(Blyaficator)
|
||||
.add_filter(ExcludedChatsFilter(args.excluded_chats.clone()))
|
||||
@ -168,8 +175,6 @@ async fn run(args: BotConfig, client: Client) -> anyhow::Result<()> {
|
||||
&[".cid"],
|
||||
TextMatchMethod::StartsWith,
|
||||
))),
|
||||
// .add_filter(TextFilter(&[".cid"], TextMatchMethod::)),
|
||||
// Notify all.
|
||||
FilteredHandler::new(NotifyAll)
|
||||
.add_filter(ExcludedChatsFilter(args.excluded_chats.clone()))
|
||||
.add_filter(UpdateTypeFilter(&[UpdateType::New]))
|
||||
@ -265,7 +270,7 @@ pub async fn start(args: BotConfig, web_code: Arc<RwLock<Option<String>>>) -> an
|
||||
Err(err) => {
|
||||
log::error!("{err}");
|
||||
}
|
||||
Ok(_) => {
|
||||
Ok(()) => {
|
||||
log::info!("Lol, messages are ended.");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user