Added start command
This commit is contained in:
parent
00bbb7e960
commit
05c7f721ec
@ -10,6 +10,7 @@ mod get_accounts;
|
|||||||
mod help;
|
mod help;
|
||||||
mod import;
|
mod import;
|
||||||
mod set_master_pass;
|
mod set_master_pass;
|
||||||
|
mod start;
|
||||||
|
|
||||||
pub use add_account::add_account;
|
pub use add_account::add_account;
|
||||||
pub use cancel::cancel;
|
pub use cancel::cancel;
|
||||||
@ -23,3 +24,4 @@ pub use get_accounts::get_accounts;
|
|||||||
pub use help::help;
|
pub use help::help;
|
||||||
pub use import::import;
|
pub use import::import;
|
||||||
pub use set_master_pass::set_master_pass;
|
pub use set_master_pass::set_master_pass;
|
||||||
|
pub use start::start;
|
||||||
|
11
src/handlers/commands/start.rs
Normal file
11
src/handlers/commands/start.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use teloxide::{adaptors::Throttle, prelude::*};
|
||||||
|
|
||||||
|
pub async fn start(bot: Throttle<Bot>, 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(())
|
||||||
|
}
|
@ -43,6 +43,8 @@ type PackagedHandler<T> = Arc<Mutex<Option<Handler<T>>>>;
|
|||||||
description = "These commands are supported:"
|
description = "These commands are supported:"
|
||||||
)]
|
)]
|
||||||
enum Command {
|
enum Command {
|
||||||
|
#[command(description = "displays the welcome message")]
|
||||||
|
Start,
|
||||||
#[command(description = "displays this text")]
|
#[command(description = "displays this text")]
|
||||||
Help,
|
Help,
|
||||||
#[command(description = "sets the master password")]
|
#[command(description = "sets the master password")]
|
||||||
@ -87,6 +89,7 @@ pub fn get_dispatcher(
|
|||||||
let bot = Bot::new(token).throttle(Limits::default());
|
let bot = Bot::new(token).throttle(Limits::default());
|
||||||
|
|
||||||
let command_handler = filter_command::<Command, _>()
|
let command_handler = filter_command::<Command, _>()
|
||||||
|
.branch(case![Command::Start].endpoint(commands::start))
|
||||||
.branch(case![Command::Help].endpoint(commands::help))
|
.branch(case![Command::Help].endpoint(commands::help))
|
||||||
.branch(case![Command::SetMasterPass].endpoint(commands::set_master_pass))
|
.branch(case![Command::SetMasterPass].endpoint(commands::set_master_pass))
|
||||||
.branch(case![Command::GenPassword].endpoint(commands::gen_password))
|
.branch(case![Command::GenPassword].endpoint(commands::gen_password))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user