diff options
Diffstat (limited to 'src/commands/random_shiggy.rs')
| -rw-r--r-- | src/commands/random_shiggy.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/commands/random_shiggy.rs b/src/commands/random_shiggy.rs index c6aa6de..e509a71 100644 --- a/src/commands/random_shiggy.rs +++ b/src/commands/random_shiggy.rs @@ -1,13 +1,17 @@ use crate::api::shiggy::get_random_shiggy; -use serenity::builder::CreateApplicationCommand; -use serenity::model::prelude::application_command::CommandDataOption; +use crate::{Context, Error}; -pub async fn run(_: &[CommandDataOption]) -> String { - get_random_shiggy().await -} - -pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { - command - .name("random_shiggy") - .description("get a random shiggy!") +/// get a random shiggy +#[poise::command(prefix_command, slash_command)] +pub async fn random_shiggy(ctx: Context<'_>) -> Result<(), Error> { + match 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) + } + } } |
