diff options
| author | seth <[email protected]> | 2023-11-15 23:54:05 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-16 05:41:54 +0000 |
| commit | 387b7dee5c022dab74bd7afc920b58793b8308de (patch) | |
| tree | cef0287106ba6e095b092db8d752395a9341f879 /src/commands/random.rs | |
| parent | fe9bcd7dc1833d5ba5ad75a84794217d8d840d56 (diff) | |
refactor: merge all random commands
Diffstat (limited to 'src/commands/random.rs')
| -rw-r--r-- | src/commands/random.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/commands/random.rs b/src/commands/random.rs new file mode 100644 index 0000000..6c61fdc --- /dev/null +++ b/src/commands/random.rs @@ -0,0 +1,51 @@ +use crate::{api, consts, utils, Context, Error}; + +#[poise::command(slash_command, subcommands("lore", "teawie", "shiggy"))] +pub async fn random(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} + +/// get a random piece of teawie lore! +#[poise::command(prefix_command, slash_command)] +pub async fn lore(ctx: Context<'_>) -> Result<(), Error> { + match utils::random_choice(consts::LORE) { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("i can't think of any right now :(").await?; + Err(why) + } + } +} + +/// get a random teawie +#[poise::command(prefix_command, slash_command)] +pub async fn teawie(ctx: Context<'_>) -> Result<(), Error> { + match api::guzzle::get_random_teawie().await { + Ok(resp) => { + ctx.say(resp).await?; + Ok(()) + } + Err(why) => { + ctx.say("i'm too lazy to send a selfie").await?; + Err(why) + } + } +} + +/// get a random shiggy +#[poise::command(prefix_command, slash_command)] +pub async fn shiggy(ctx: Context<'_>) -> Result<(), Error> { + match api::shiggy::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) + } + } +} |
