From 0117a6b567d481d0ddd74d78b037712ab500cf77 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Fri, 16 Dec 2022 23:12:24 +0100 Subject: [PATCH] Update channel handler --- .../approved_bot/services/book_cache/mod.rs | 2 +- src/bots/mod.rs | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/bots/approved_bot/services/book_cache/mod.rs b/src/bots/approved_bot/services/book_cache/mod.rs index 7f74009..652eae9 100644 --- a/src/bots/approved_bot/services/book_cache/mod.rs +++ b/src/bots/approved_bot/services/book_cache/mod.rs @@ -84,7 +84,7 @@ pub async fn download_file( let headers = response.headers(); - log::debug!("Download headers: {:?}", headers); + log::info!("Download headers: {:?}", headers); let filename = headers .get("content-disposition") diff --git a/src/bots/mod.rs b/src/bots/mod.rs index 0c88716..802ff14 100644 --- a/src/bots/mod.rs +++ b/src/bots/mod.rs @@ -15,14 +15,9 @@ type BotHandler = Handler< type BotCommands = Option>; -fn ignore_channel_messages() -> crate::bots::BotHandler -{ - Update::filter_message() - .chain(dptree::filter(move |message: Message| { - message.chat.is_channel() - })).endpoint(|_message: Message, _bot: AutoSend| async { - Ok(()) - }) +fn ignore_channel_messages() -> crate::bots::BotHandler { + Update::filter_channel_post() + .endpoint(|_message: Message, _bot: AutoSend| async { Ok(()) }) } fn get_pending_handler() -> BotHandler { @@ -38,9 +33,7 @@ fn get_pending_handler() -> BotHandler { dptree::entry() .branch(ignore_channel_messages()) - .branch( - Update::filter_message().chain(dptree::endpoint(handler)) - ) + .branch(Update::filter_message().chain(dptree::endpoint(handler))) } fn get_blocked_handler() -> BotHandler { @@ -53,9 +46,7 @@ fn get_blocked_handler() -> BotHandler { dptree::entry() .branch(ignore_channel_messages()) - .branch( - Update::filter_message().chain(dptree::endpoint(handler)) - ) + .branch(Update::filter_message().chain(dptree::endpoint(handler))) } pub fn get_bot_handler(status: crate::bots_manager::BotStatus) -> (BotHandler, BotCommands) {