Updated deps, updated generate_passwords to return an array
This commit is contained in:
		@@ -29,7 +29,7 @@ fn check_generated_password(password: &[u8]) -> bool {
 | 
			
		||||
 | 
			
		||||
/// Continuously generates the password until it passes the checks
 | 
			
		||||
#[inline]
 | 
			
		||||
fn generete_passwords() -> ArrayVec<ArrayString<34>, 10> {
 | 
			
		||||
fn generate_passwords() -> [ArrayString<34>; 10] {
 | 
			
		||||
    let mut passwords = ArrayVec::new_const();
 | 
			
		||||
    while !passwords.is_full() {
 | 
			
		||||
        let password: ArrayVec<u8, 32> = (0..32)
 | 
			
		||||
@@ -43,13 +43,13 @@ fn generete_passwords() -> ArrayVec<ArrayString<34>, 10> {
 | 
			
		||||
            passwords.push(string)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    passwords
 | 
			
		||||
    unsafe { passwords.into_inner_unchecked() }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Handles /gen_password command by generating 10 copyable passwords and sending them to the user
 | 
			
		||||
pub async fn gen_password(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
 | 
			
		||||
    let mut message: ArrayString<{ 10 + 35 * 10 }> = "Passwords:".try_into().unwrap();
 | 
			
		||||
    let passwords = spawn_blocking(generete_passwords).await?;
 | 
			
		||||
    let passwords = spawn_blocking(generate_passwords).await?;
 | 
			
		||||
    for password in passwords {
 | 
			
		||||
        message.push('\n');
 | 
			
		||||
        message.push_str(&password)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user