Просмотр исходного кода

[Telegram] NewAccount command added

Slava Barinov 2 лет назад
Родитель
Сommit
56c30d8e78
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      src/telegram.rs

+ 9 - 0
src/telegram.rs

@@ -74,6 +74,9 @@ enum Command {
 
 
     #[command(description = "Cancel processing of current file")]
     #[command(description = "Cancel processing of current file")]
     Cancel,
     Cancel,
+
+    #[command(description = "Create new account")]
+    NewAccount { account: String },
 }
 }
 
 
 async fn command_handler(
 async fn command_handler(
@@ -106,6 +109,12 @@ async fn command_handler(
             bot.send_message(msg.chat.id, "Dialogue state reset".to_string())
             bot.send_message(msg.chat.id, "Dialogue state reset".to_string())
                 .await?
                 .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(())
     Ok(())