mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Update channel handler
This commit is contained in:
@@ -84,7 +84,7 @@ pub async fn download_file(
|
|||||||
|
|
||||||
let headers = response.headers();
|
let headers = response.headers();
|
||||||
|
|
||||||
log::debug!("Download headers: {:?}", headers);
|
log::info!("Download headers: {:?}", headers);
|
||||||
|
|
||||||
let filename = headers
|
let filename = headers
|
||||||
.get("content-disposition")
|
.get("content-disposition")
|
||||||
|
|||||||
@@ -15,14 +15,9 @@ type BotHandler = Handler<
|
|||||||
|
|
||||||
type BotCommands = Option<Vec<teloxide::types::BotCommand>>;
|
type BotCommands = Option<Vec<teloxide::types::BotCommand>>;
|
||||||
|
|
||||||
fn ignore_channel_messages() -> crate::bots::BotHandler
|
fn ignore_channel_messages() -> crate::bots::BotHandler {
|
||||||
{
|
Update::filter_channel_post()
|
||||||
Update::filter_message()
|
.endpoint(|_message: Message, _bot: AutoSend<Bot>| async { Ok(()) })
|
||||||
.chain(dptree::filter(move |message: Message| {
|
|
||||||
message.chat.is_channel()
|
|
||||||
})).endpoint(|_message: Message, _bot: AutoSend<Bot>| async {
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pending_handler() -> BotHandler {
|
fn get_pending_handler() -> BotHandler {
|
||||||
@@ -38,9 +33,7 @@ fn get_pending_handler() -> BotHandler {
|
|||||||
|
|
||||||
dptree::entry()
|
dptree::entry()
|
||||||
.branch(ignore_channel_messages())
|
.branch(ignore_channel_messages())
|
||||||
.branch(
|
.branch(Update::filter_message().chain(dptree::endpoint(handler)))
|
||||||
Update::filter_message().chain(dptree::endpoint(handler))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_blocked_handler() -> BotHandler {
|
fn get_blocked_handler() -> BotHandler {
|
||||||
@@ -53,9 +46,7 @@ fn get_blocked_handler() -> BotHandler {
|
|||||||
|
|
||||||
dptree::entry()
|
dptree::entry()
|
||||||
.branch(ignore_channel_messages())
|
.branch(ignore_channel_messages())
|
||||||
.branch(
|
.branch(Update::filter_message().chain(dptree::endpoint(handler)))
|
||||||
Update::filter_message().chain(dptree::endpoint(handler))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_bot_handler(status: crate::bots_manager::BotStatus) -> (BotHandler, BotCommands) {
|
pub fn get_bot_handler(status: crate::bots_manager::BotStatus) -> (BotHandler, BotCommands) {
|
||||||
|
|||||||
Reference in New Issue
Block a user