From 8b7a7a563111dc8ffc6928d33cc7b03d5fdf8005 Mon Sep 17 00:00:00 2001 From: shibedrill <53824200+shibedrill@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:28:37 -0400 Subject: [PATCH] some cleanup --- src/command/fun.rs | 14 ++++++-------- src/command/util.rs | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/command/fun.rs b/src/command/fun.rs index 92d6112..6575a39 100644 --- a/src/command/fun.rs +++ b/src/command/fun.rs @@ -52,10 +52,9 @@ pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> { // Create an RNG let mut rng = rand::thread_rng(); - let mut output; // Possibly uppercase or lowercase - output = match rng.gen_bool(0.5) { + let output = match rng.gen_bool(0.5) { true => input.to_ascii_uppercase(), false => input.to_ascii_uppercase(), }; @@ -64,14 +63,13 @@ pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> { let mut new_string = "*".repeat(n); new_string.push_str(&output); new_string.push_str(&"*".repeat(n)); - output = new_string; // Return modified string - output + new_string } let sound: String = match rand::thread_rng().gen_range(0..3) { - 0 => { + 0..=10 => { let count = rand::thread_rng().gen_range(1..3); let mut new_sound: String = String::new(); for _i in 0..count { @@ -80,13 +78,13 @@ pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> { } new_sound } - 1 => { + 11 => { format!("am so {}ing awesome", modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())) } - 2 => { + 12 => { format!("feel so {} like a {} machine", modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap()), modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())) } - 3 => { + 13 => { format!("do it {}", modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())) } _ => unreachable!(), diff --git a/src/command/util.rs b/src/command/util.rs index 290aefc..b46e17e 100644 --- a/src/command/util.rs +++ b/src/command/util.rs @@ -20,7 +20,7 @@ pub async fn age( #[poise::command(slash_command)] pub async fn info(ctx: Context<'_>) -> Result<(), Error> { ctx.say(format!( - "DeerBot ReBleated v{} was created by Shibe Drill (@shibedrill) using Rust and Poise.\nVisit her website: https://riverdev.carrd.co\nCheck out her Github: https://github.com/shibedrill", + "DeerBot ReBleated v{} was created by Shibe Drill (@shibedrill) using Rust and Poise.\nVisit her website: https://riverdev.carrd.co\nCheck out her Github: https://github.com/shibedrill\nPoise: https://docs.rs/poise/latest/poise/\nRust: https://www.rust-lang.org/", env!("CARGO_PKG_VERSION") )) .await?;