From a14e362054c6c96ff840c7297e8b575e83f60029 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 17 Nov 2023 20:29:32 -0500 Subject: feat: put random teawie/shiggy in embed --- src/commands/random.rs | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src/commands') diff --git a/src/commands/random.rs b/src/commands/random.rs index 6c61fdc..bc34928 100644 --- a/src/commands/random.rs +++ b/src/commands/random.rs @@ -23,29 +23,22 @@ pub async fn lore(ctx: Context<'_>) -> Result<(), Error> { /// get a random teawie #[poise::command(prefix_command, slash_command)] pub async fn teawie(ctx: Context<'_>) -> Result<(), Error> { - match api::guzzle::get_random_teawie().await { - Ok(resp) => { - ctx.say(resp).await?; - Ok(()) - } - Err(why) => { - ctx.say("i'm too lazy to send a selfie").await?; - Err(why) - } + if let Ok(url) = api::guzzle::get_random_teawie().await { + utils::send_url_as_embed(ctx, url).await + } else { + ctx.say("i'm too lazy to send a selfie right now :(") + .await?; + Ok(()) } } /// get a random shiggy #[poise::command(prefix_command, slash_command)] pub async fn shiggy(ctx: Context<'_>) -> Result<(), Error> { - match api::shiggy::get_random_shiggy().await { - Ok(resp) => { - ctx.say(resp).await?; - Ok(()) - } - Err(why) => { - ctx.say("i can't get a shiggy right now :(").await?; - Err(why) - } + if let Ok(url) = api::shiggy::get_random_shiggy().await { + utils::send_url_as_embed(ctx, url).await + } else { + ctx.say("i couldn't get a shiggy right now :(").await?; + Ok(()) } } -- cgit v1.2.3