mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-07-09 05:14:07 +00:00
test
This commit is contained in:
16
src/main.rs
16
src/main.rs
@ -18,7 +18,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
MessageKind::Text { ref data, .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: {}",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -37,7 +37,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
..
|
||||
} => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *PHOTO* {}",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -50,7 +50,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
MessageKind::Document { ref caption, .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *DOCUMENT* {}",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -70,7 +70,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
MessageKind::Sticker { ref data, .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *STICKER*",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -82,7 +82,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
MessageKind::Voice { .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *VOICE*",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -94,7 +94,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
MessageKind::Video { .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *VIDEO*",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -106,7 +106,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
MessageKind::VideoNote { .. } => {
|
||||
let title = utils::get_title(&message);
|
||||
println!(
|
||||
info!(
|
||||
"<{}({})>[{}({})]: *VIDEO_NOTE*",
|
||||
&message.chat.id(),
|
||||
title,
|
||||
@ -122,7 +122,7 @@ async fn handler(api: Api, message: Message, token: String) -> Result<(), errors
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), errors::Error> {
|
||||
env_logger::from_env(Env::default().default_filter_or("debug")).init();
|
||||
env_logger::from_env(Env::default().default_filter_or("info")).init();
|
||||
let token = match env::var("TELEGRAM_BOT_TOKEN") {
|
||||
Ok(token) => token,
|
||||
Err(_) => {
|
||||
|
@ -67,7 +67,7 @@ pub(crate) async fn get_files(
|
||||
let file_hash = hasher.digest().to_string();
|
||||
match db::get_file(file_hash.clone()).await {
|
||||
Ok(_) => {
|
||||
println!("File exist");
|
||||
info!("File {} exist", file_hash);
|
||||
}
|
||||
Err(_) => {
|
||||
let mut dest = File::create(path.clone())?;
|
||||
@ -76,7 +76,7 @@ pub(crate) async fn get_files(
|
||||
};
|
||||
db::add_file(&message, path, file_hash).await?;
|
||||
}
|
||||
Err(e) => println!("Couldn't get file: {}", e)
|
||||
Err(e) => warn!("Couldn't get file: {}", e)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user