Ver Fonte

[Telegram] NewAccount command added

Slava Barinov há 2 anos atrás
pai
commit
56c30d8e78
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      src/telegram.rs

+ 9 - 0
src/telegram.rs

@@ -74,6 +74,9 @@ enum Command {
 
     #[command(description = "Cancel processing of current file")]
     Cancel,
+
+    #[command(description = "Create new account")]
+    NewAccount { account: String },
 }
 
 async fn command_handler(
@@ -106,6 +109,12 @@ async fn command_handler(
             bot.send_message(msg.chat.id, "Dialogue state reset".to_string())
                 .await?
         }
+        Command::NewAccount { account } => {
+            let mut user = User::new(msg.chat.id.0, &None);
+            user.new_account(account);
+            bot.send_message(msg.chat.id, "Account added".to_string())
+                .await?
+        }
     };
 
     Ok(())