From 76c0f94e6d7aa108424b34826eb7d8514b026287 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 30 Nov 2023 22:18:51 -0500 Subject: feat: use eyre, better logging, & refactor small commits be damned --- src/commands/ask.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/commands/ask.rs') diff --git a/src/commands/ask.rs b/src/commands/ask.rs index 7cc82a1..3589484 100644 --- a/src/commands/ask.rs +++ b/src/commands/ask.rs @@ -1,6 +1,6 @@ -use crate::consts; -use crate::utils; -use crate::{Context, Error}; +use crate::{consts, utils, Context}; + +use color_eyre::eyre::{Context as _, Result}; /// ask teawie a question! #[poise::command(prefix_command, slash_command)] @@ -9,15 +9,10 @@ pub async fn ask( #[description = "the question you want to ask teawie"] #[rename = "question"] _question: String, -) -> Result<(), Error> { - match utils::random_choice(consts::RESPONSES) { - Ok(resp) => { - ctx.say(resp).await?; - Ok(()) - } - Err(why) => { - ctx.say("idk").await?; - Err(why) - } - } +) -> Result<()> { + let resp = utils::random_choice(consts::RESPONSES) + .wrap_err("couldn't choose from random responses!")?; + + ctx.say(resp).await?; + Ok(()) } -- cgit v1.2.3