diff --git a/src/handlers/commands/mod.rs b/src/handlers/commands/mod.rs index fbc9314..f3007cd 100644 --- a/src/handlers/commands/mod.rs +++ b/src/handlers/commands/mod.rs @@ -10,6 +10,7 @@ mod get_accounts; mod help; mod import; mod set_master_pass; +mod start; pub use add_account::add_account; pub use cancel::cancel; @@ -23,3 +24,4 @@ pub use get_accounts::get_accounts; pub use help::help; pub use import::import; pub use set_master_pass::set_master_pass; +pub use start::start; diff --git a/src/handlers/commands/start.rs b/src/handlers/commands/start.rs new file mode 100644 index 0000000..b5fd991 --- /dev/null +++ b/src/handlers/commands/start.rs @@ -0,0 +1,11 @@ +use teloxide::{adaptors::Throttle, prelude::*}; + +pub async fn start(bot: Throttle, msg: Message) -> crate::Result<()> { + bot.send_message( + msg.chat.id, + "Hi! This bot can be used to store the passwords securely. \ + Use /help command to get the list of commands", + ) + .await?; + Ok(()) +} diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index d50e7b2..db664a1 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -43,6 +43,8 @@ type PackagedHandler = Arc>>>; description = "These commands are supported:" )] enum Command { + #[command(description = "displays the welcome message")] + Start, #[command(description = "displays this text")] Help, #[command(description = "sets the master password")] @@ -87,6 +89,7 @@ pub fn get_dispatcher( let bot = Bot::new(token).throttle(Limits::default()); let command_handler = filter_command::() + .branch(case![Command::Start].endpoint(commands::start)) .branch(case![Command::Help].endpoint(commands::help)) .branch(case![Command::SetMasterPass].endpoint(commands::set_master_pass)) .branch(case![Command::GenPassword].endpoint(commands::gen_password))