Added cancel command to allow the user to know that they can use it
This commit is contained in:
		
							
								
								
									
										6
									
								
								src/handlers/commands/cancel.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/handlers/commands/cancel.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
use teloxide::{adaptors::Throttle, prelude::*};
 | 
			
		||||
 | 
			
		||||
pub async fn cancel(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
 | 
			
		||||
    bot.send_message(msg.chat.id, "Nothing to cancel").await?;
 | 
			
		||||
    Ok(())
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
mod add_account;
 | 
			
		||||
mod cancel;
 | 
			
		||||
mod default;
 | 
			
		||||
mod delete;
 | 
			
		||||
mod delete_all;
 | 
			
		||||
@@ -11,6 +12,7 @@ mod import;
 | 
			
		||||
mod set_master_pass;
 | 
			
		||||
 | 
			
		||||
pub use add_account::add_account;
 | 
			
		||||
pub use cancel::cancel;
 | 
			
		||||
pub use default::default;
 | 
			
		||||
pub use delete::delete;
 | 
			
		||||
pub use delete_all::delete_all;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,8 @@ enum Command {
 | 
			
		||||
    Import,
 | 
			
		||||
    #[command(description = "generates 10 secure passwords")]
 | 
			
		||||
    GenPassword,
 | 
			
		||||
    #[command(description = "cancels the current action")]
 | 
			
		||||
    Cancel,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Default, Clone)]
 | 
			
		||||
@@ -88,6 +90,7 @@ pub fn get_dispatcher(
 | 
			
		||||
        .branch(case![Command::Help].endpoint(commands::help))
 | 
			
		||||
        .branch(case![Command::SetMasterPass].endpoint(commands::set_master_pass))
 | 
			
		||||
        .branch(case![Command::GenPassword].endpoint(commands::gen_password))
 | 
			
		||||
        .branch(case![Command::Cancel].endpoint(commands::cancel))
 | 
			
		||||
        .branch(master_password_check::get_handler())
 | 
			
		||||
        .branch(case![Command::AddAccount].endpoint(commands::add_account))
 | 
			
		||||
        .branch(case![Command::GetAccount].endpoint(commands::get_account))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user