From 8d2e5dec41f6ad605cd2f028625549da977259ab Mon Sep 17 00:00:00 2001 From: Alex Page Date: Thu, 20 Jan 2022 21:04:48 -0500 Subject: [PATCH] Add snarky error messages --- src/commands.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 5bae010..785f5ce 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -21,7 +21,7 @@ pub async fn join(ctx: &Context, command: &ApplicationCommandInteraction) -> Str let connect_to = match channel_id { Some(channel) => channel, None => { - return "You're not in a voice channel".to_string(); + return "You're not in a voice channel. How do I know where to go?".to_string(); } }; @@ -32,7 +32,7 @@ pub async fn join(ctx: &Context, command: &ApplicationCommandInteraction) -> Str let _handler = manager.join(guild_id, connect_to).await; - "Joining your channel".to_string() + "Joining your channel!".to_string() } pub async fn leave(ctx: &Context, command: &ApplicationCommandInteraction) -> String { @@ -49,9 +49,9 @@ pub async fn leave(ctx: &Context, command: &ApplicationCommandInteraction) -> St return format!("Failed: {:?}", e); } - "Left voice channel".to_string() + "Goodbye!".to_string() } else { - "I'm not in a voice channel".to_string() + "I can't leave if I'm not there to bein with!".to_string() } } @@ -68,12 +68,12 @@ pub async fn play(ctx: &mut Context, command: &ApplicationCommandInteraction) -> let url = match options { ApplicationCommandInteractionDataOptionValue::String(url) => url, _ => { - return "Must provide a URL to a video or audio".to_string(); + return "You didn't tell me what to play.".to_string(); } }; if !url.starts_with("http") { - return "Must provide a valid URL".to_string(); + return "That's not a real URL. I'm onto you.".to_string(); } let guild_id = command.guild_id.unwrap(); @@ -91,7 +91,7 @@ pub async fn play(ctx: &mut Context, command: &ApplicationCommandInteraction) -> Err(why) => { println!("Err starting source: {:?}", why); - return "Error sourcing ffmpeg".to_string(); + return "Something went horribly wrong. Go yell at Valter.".to_string(); } }; @@ -100,11 +100,11 @@ pub async fn play(ctx: &mut Context, command: &ApplicationCommandInteraction) -> let message = { if let Some(title) = &source_input.metadata.title { let mut msg = MessageBuilder::new(); - msg.push_line("Playing song:"); + msg.push_line("Playing this:"); msg.push_named_link(title, url); msg.build() } else { - "Playing song".to_string() + "Playing something, I dunno what.".to_string() } }; @@ -141,7 +141,7 @@ pub async fn stop(ctx: &Context, command: &ApplicationCommandInteraction) -> Str "Stopping song".to_string() } else { - "Not in a voice channel to play in".to_string() + "I'm not even in a channel to begin with. Silly.".to_string() } } @@ -158,12 +158,12 @@ pub async fn set_volume(ctx: &mut Context, command: &ApplicationCommandInteracti let volume = match options { ApplicationCommandInteractionDataOptionValue::Number(volume) => *volume, _ => { - return "Must provide a volume level".to_string(); + return "You've gotta give me a volume level to set.".to_string(); } }; if !(0.0..=100.0).contains(&volume) { - return "Must provide a value between 0 and 100".to_string(); + return "Volume has to be between 0 and 100.".to_string(); } let mut data = ctx.data.write().await; @@ -175,9 +175,9 @@ pub async fn set_volume(ctx: &mut Context, command: &ApplicationCommandInteracti let current_track = data.get::().unwrap(); if let Some(track) = current_track { track.set_volume(new_volume).unwrap(); - format!("Setting volume to {}%", volume) + format!("Setting volume to {}%.", volume) } else { - "No track is currently playing".to_string() + "Nothing's currently playing and for some reason, something needs to be playing to set the volume.".to_string() } } @@ -194,7 +194,7 @@ pub async fn set_loop(ctx: &mut Context, command: &ApplicationCommandInteraction let loops = match options { ApplicationCommandInteractionDataOptionValue::Boolean(loops) => *loops, _ => { - return "Must provide whether or not to loop".to_string(); + return "Do you want me to loop the song or not? Be specific.".to_string(); } }; @@ -203,13 +203,13 @@ pub async fn set_loop(ctx: &mut Context, command: &ApplicationCommandInteraction if let Some(track) = current_track { if loops { track.enable_loop().expect("Couldn't enable looping"); - return format!("Enabling looping on the current track"); + return format!("Loopin'!"); } else { track.disable_loop().expect("Couldn't disable looping"); - return format!("Disabling looping on the current track"); + return format!("This is the last time this track will EVER be played."); } } else { - "No track is currently playing".to_string() + "I can't loop a song if there is no song to loop.".to_string() } }