some cleanup

This commit is contained in:
shibedrill 2024-04-16 22:28:37 -04:00
parent 53464ab946
commit 8b7a7a5631
2 changed files with 7 additions and 9 deletions

View File

@ -52,10 +52,9 @@ pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> {
// Create an RNG // Create an RNG
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let mut output;
// Possibly uppercase or lowercase // Possibly uppercase or lowercase
output = match rng.gen_bool(0.5) { let output = match rng.gen_bool(0.5) {
true => input.to_ascii_uppercase(), true => input.to_ascii_uppercase(),
false => 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); let mut new_string = "*".repeat(n);
new_string.push_str(&output); new_string.push_str(&output);
new_string.push_str(&"*".repeat(n)); new_string.push_str(&"*".repeat(n));
output = new_string;
// Return modified string // Return modified string
output new_string
} }
let sound: String = match rand::thread_rng().gen_range(0..3) { let sound: String = match rand::thread_rng().gen_range(0..3) {
0 => { 0..=10 => {
let count = rand::thread_rng().gen_range(1..3); let count = rand::thread_rng().gen_range(1..3);
let mut new_sound: String = String::new(); let mut new_sound: String = String::new();
for _i in 0..count { for _i in 0..count {
@ -80,13 +78,13 @@ pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> {
} }
new_sound new_sound
} }
1 => { 11 => {
format!("am so {}ing awesome", modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())) 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())) 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())) format!("do it {}", modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap()))
} }
_ => unreachable!(), _ => unreachable!(),

View File

@ -20,7 +20,7 @@ pub async fn age(
#[poise::command(slash_command)] #[poise::command(slash_command)]
pub async fn info(ctx: Context<'_>) -> Result<(), Error> { pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
ctx.say(format!( 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") env!("CARGO_PKG_VERSION")
)) ))
.await?; .await?;