summaryrefslogtreecommitdiff
path: root/src/commands/ask.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-30 22:18:51 -0500
committerseth <[email protected]>2023-12-01 07:12:49 -0500
commit76c0f94e6d7aa108424b34826eb7d8514b026287 (patch)
tree7315bd6dfe52c158041bed64ba39781718a69335 /src/commands/ask.rs
parentdb52e639b85d79bed870020aec7a045851ca5ee3 (diff)
feat: use eyre, better logging, & refactor
small commits be damned
Diffstat (limited to 'src/commands/ask.rs')
-rw-r--r--src/commands/ask.rs23
1 files changed, 9 insertions, 14 deletions
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(())
}