commands: tidy up help & joke

This commit is contained in:
seth 2024-03-23 11:11:17 -04:00
parent e847ea0ad0
commit b63ecde6b4
3 changed files with 17 additions and 17 deletions

View file

@ -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<String>,
#[description = "Provide information about a specific command"] command: Option<String>,
) -> 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(())
}

View file

@ -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(())
}

View file

@ -1,11 +1,12 @@
use crate::Data;
use eyre::Report;
use poise::Command;
mod general;
pub fn get() -> Vec<Command<Data, Report>> {
pub type Command = poise::Command<Data, Report>;
pub fn get() -> Vec<Command> {
vec![
general::joke(),
general::members(),