From b63ecde6b4bbeaf2d0775fa87369c5c8bd6134b8 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 23 Mar 2024 11:11:17 -0400 Subject: [PATCH] commands: tidy up help & joke --- src/commands/general/help.rs | 26 +++++++++++++------------- src/commands/general/joke.rs | 3 +-- src/commands/mod.rs | 5 +++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/commands/general/help.rs b/src/commands/general/help.rs index bdf3047..f91d97d 100644 --- a/src/commands/general/help.rs +++ b/src/commands/general/help.rs @@ -1,23 +1,23 @@ -use eyre::Result; -use poise::{builtins, samples::HelpConfiguration}; - use crate::Context; +use eyre::Result; +use log::trace; +use poise::samples::HelpConfiguration; + /// View the help menu #[poise::command(slash_command, prefix_command, track_edits = true)] pub async fn help( ctx: Context<'_>, - #[description = "provide information about a specific command"] command: Option, + #[description = "Provide information about a specific command"] command: Option, ) -> Result<()> { - builtins::help( - ctx, - command.as_deref(), - HelpConfiguration { - extra_text_at_bottom: "Use /help for more information about a specific command!", - ..HelpConfiguration::default() - }, - ) - .await?; + trace!("Running help command"); + + let configuration = HelpConfiguration { + extra_text_at_bottom: "Use /help for more information about a specific command!", + ..Default::default() + }; + + poise::builtins::help(ctx, command.as_deref(), configuration).await?; Ok(()) } diff --git a/src/commands/general/joke.rs b/src/commands/general/joke.rs index fb39d20..fbced97 100644 --- a/src/commands/general/joke.rs +++ b/src/commands/general/joke.rs @@ -10,9 +10,8 @@ pub async fn joke(ctx: Context<'_>) -> Result<()> { trace!("Running joke command"); ctx.defer().await?; - let joke = dadjoke::get_joke().await?; - ctx.say(joke).await?; + Ok(()) } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 0d44cbe..b8f7418 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,11 +1,12 @@ use crate::Data; use eyre::Report; -use poise::Command; mod general; -pub fn get() -> Vec> { +pub type Command = poise::Command; + +pub fn get() -> Vec { vec![ general::joke(), general::members(),