diff options
| author | seth <[email protected]> | 2023-07-10 00:18:36 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-16 00:35:07 +0000 |
| commit | a4a9353e1c8f902b7d7b3cf74e3e5b129c214330 (patch) | |
| tree | b58da1d30af52e97c0251e0d6882cd0ccdfeb20a /src/commands/random_shiggy.rs | |
| parent | 5e9ec7f008e01d25c0b7f782c5ae043bc9ca0933 (diff) | |
start using poise
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) + } + } } |
