Browse Source

[Telegram] A bit more logging added

Slava Barinov 2 years ago
parent
commit
9fc7dc0dd7
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/telegram.rs

+ 5 - 1
src/telegram.rs

@@ -127,6 +127,7 @@ async fn command_handler(
                 .await?
                 .await?
         }
         }
         Command::Cancel => {
         Command::Cancel => {
+            log::info!("Reset requested");
             dialogue.update(State::Idle).await?;
             dialogue.update(State::Idle).await?;
             bot.send_message(msg.chat.id, "Dialogue state reset".to_string())
             bot.send_message(msg.chat.id, "Dialogue state reset".to_string())
                 .await?
                 .await?
@@ -135,7 +136,8 @@ async fn command_handler(
             let acc_to_add = account.trim();
             let acc_to_add = account.trim();
 
 
             if acc_to_add.is_empty() {
             if acc_to_add.is_empty() {
-                bot.send_message(msg.chat.id, "Please enter new account name".to_string())
+                log::warn!("/newaccount executed without account name");
+                bot.send_message(msg.chat.id, "No account name provided".to_string())
                     .await?
                     .await?
             } else {
             } else {
                 let (response_tx, response_rx) = oneshot::channel();
                 let (response_tx, response_rx) = oneshot::channel();
@@ -151,6 +153,7 @@ async fn command_handler(
                     bot.send_message(msg.chat.id, "Account added".to_string())
                     bot.send_message(msg.chat.id, "Account added".to_string())
                         .await?
                         .await?
                 } else {
                 } else {
+                    log::error!("Request for unknown userid {}", msg.chat.id.0);
                     bot.send_message(msg.chat.id, "Can't find the requested user".to_string())
                     bot.send_message(msg.chat.id, "Can't find the requested user".to_string())
                         .await?
                         .await?
                 }
                 }
@@ -187,6 +190,7 @@ async fn command_handler(
                 )
                 )
                 .await?
                 .await?
             } else {
             } else {
+                log::error!("Request for unknown userid {}", msg.chat.id.0);
                 bot.send_message(msg.chat.id, "Can't find the requested user".to_string())
                 bot.send_message(msg.chat.id, "Can't find the requested user".to_string())
                     .await?
                     .await?
             }
             }