clean warnings and add tests
This commit is contained in:
15
src/lib.rs
15
src/lib.rs
@@ -6,7 +6,7 @@ pub mod check_permissions;
|
||||
mod database;
|
||||
mod filter_files;
|
||||
mod pole_dialogue;
|
||||
mod rewrite_links;
|
||||
pub mod rewrite_links;
|
||||
mod spoiler_mangas;
|
||||
mod telegram_utils;
|
||||
|
||||
@@ -39,7 +39,6 @@ pub async fn run() {
|
||||
let permissions = Arc::new(check_permissions::GroupPermissions::new());
|
||||
let p1 = Arc::clone(&permissions);
|
||||
let p2 = Arc::clone(&permissions);
|
||||
//Command::repl(bot.clone(), answer).await;
|
||||
let handler = Update::filter_message()
|
||||
.branch(
|
||||
dptree::filter(move |msg: Message| !p1.compare(&msg.chat.id.to_string())).endpoint(
|
||||
@@ -72,14 +71,12 @@ pub async fn run() {
|
||||
Ok(())
|
||||
}),
|
||||
)
|
||||
/*
|
||||
Now is useless because the group doesn't make any spoiler
|
||||
.branch(
|
||||
dptree::filter(move |msg: Message| {
|
||||
(is_photo(msg.clone()) && p2.compar_party(&msg.chat.id.to_string()))
|
||||
is_photo(msg.clone()) && p2.compar_party(&msg.chat.id.to_string())
|
||||
})
|
||||
.endpoint(|msg: Message, bot: Bot| spoiler_mangas::check_image(msg, bot)),
|
||||
)*/
|
||||
)
|
||||
.branch(
|
||||
dptree::filter(move |msg: Message| filter_files::analyce_name::check_file(msg.clone()))
|
||||
.endpoint(|msg: Message, bot: Bot| filter_files::action::take_actions(msg, bot)),
|
||||
@@ -131,21 +128,21 @@ fn is_media(msg: Message) -> bool {
|
||||
|
||||
fn is_stiker(msg: Message) -> bool {
|
||||
match msg.sticker() {
|
||||
Some(s) => true,
|
||||
Some(_) => true,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_gif(msg: Message) -> bool {
|
||||
match msg.animation() {
|
||||
Some(s) => true,
|
||||
Some(_) => true,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_photo(msg: Message) -> bool {
|
||||
match msg.photo() {
|
||||
Some(s) => true,
|
||||
Some(_) => true,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user