1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-23 01:54:22 +00:00

Improve debug messages

This commit is contained in:
Steffo 2022-08-22 18:28:32 +02:00
parent 26257ff2a3
commit f5456980f6
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -21,6 +21,7 @@ pub fn inline_query_handler(
// It's not a real loop, it's just to make the code flow more tolerable. // It's not a real loop, it's just to make the code flow more tolerable.
let payload: AnswerInlineQuery = loop { let payload: AnswerInlineQuery = loop {
if query.query.len() == 0 { if query.query.len() == 0 {
debug!("Empty query specified.");
break AnswerInlineQuery { break AnswerInlineQuery {
inline_query_id: query.id.clone(), inline_query_id: query.id.clone(),
results: vec![], results: vec![],
@ -33,6 +34,7 @@ pub fn inline_query_handler(
} }
if let Ok(deck) = Deck::from_code(&query.query.to_ascii_uppercase()) { if let Ok(deck) = Deck::from_code(&query.query.to_ascii_uppercase()) {
debug!("Parsed deck successfully!");
break AnswerInlineQuery { break AnswerInlineQuery {
inline_query_id: query.id.clone(), inline_query_id: query.id.clone(),
results: vec![ results: vec![
@ -46,11 +48,11 @@ pub fn inline_query_handler(
} }
} }
debug!("Querying the search engine..."); debug!("Querying the card search engine...");
let results = engine.query(&query.query, 50); let results = engine.query(&query.query, 50);
if let Err(_) = results { if let Err(_) = results {
debug!("Invalid query syntax."); debug!("Invalid card search query syntax.");
break AnswerInlineQuery { break AnswerInlineQuery {
inline_query_id: query.id.clone(), inline_query_id: query.id.clone(),
results: vec![], results: vec![],
@ -77,6 +79,7 @@ pub fn inline_query_handler(
}; };
} }
debug!("Card search query successful!");
break AnswerInlineQuery { break AnswerInlineQuery {
inline_query_id: query.id.clone(), inline_query_id: query.id.clone(),
results: results results: results