diff --git a/src/handlers/commands/mod.rs b/src/handlers/commands/mod.rs index feee469..963fb31 100644 --- a/src/handlers/commands/mod.rs +++ b/src/handlers/commands/mod.rs @@ -27,3 +27,36 @@ pub use help::help; pub use import::import; pub use set_master_pass::set_master_pass; pub use start::start; +use teloxide::macros::BotCommands; + +#[derive(BotCommands, Clone, Copy)] +#[command( + rename_rule = "snake_case", + description = "These commands are supported:" +)] +pub enum Command { + #[command(description = "displays the welcome message")] + Start, + #[command(description = "displays this text")] + Help, + #[command(description = "sets the master password")] + SetMasterPass, + #[command(description = "adds the account")] + AddAccount, + #[command(description = "gets the account")] + GetAccount, + #[command(description = "gets a list of accounts")] + GetAccounts, + #[command(description = "deletes the account")] + Delete, + #[command(description = "deletes all the accounts and the master password")] + DeleteAll, + #[command(description = "exports all the accounts in a json file")] + Export, + #[command(description = "loads the accounts from a json file")] + Import, + #[command(description = "generates 10 secure passwords")] + GenPassword, + #[command(description = "cancels the current action")] + Cancel, +} diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 7ac35ce..99ce8b4 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -5,6 +5,7 @@ mod master_password_check; mod state; mod utils; +use commands::Command; use sea_orm::prelude::*; use state::{Handler, PackagedHandler}; use teloxide::{ @@ -12,43 +13,10 @@ use teloxide::{ dispatching::dialogue::InMemStorage, filter_command, prelude::*, - utils::command::BotCommands, }; type MainDialogue = Dialogue>; -#[derive(BotCommands, Clone, Copy)] -#[command( - rename_rule = "snake_case", - 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")] - SetMasterPass, - #[command(description = "adds the account")] - AddAccount, - #[command(description = "gets the account")] - GetAccount, - #[command(description = "gets a list of accounts")] - GetAccounts, - #[command(description = "deletes the account")] - Delete, - #[command(description = "deletes all the accounts and the master password")] - DeleteAll, - #[command(description = "exports all the accounts in a json file")] - Export, - #[command(description = "loads the accounts from a json file")] - Import, - #[command(description = "generates 10 secure passwords")] - GenPassword, - #[command(description = "cancels the current action")] - Cancel, -} - #[derive(Default, Clone)] pub enum State { #[default]