diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/mod.rs | 8 | ||||
| -rw-r--r-- | src/commands/random.rs | 51 | ||||
| -rw-r--r-- | src/commands/random_lore.rs | 16 | ||||
| -rw-r--r-- | src/commands/random_shiggy.rs | 17 | ||||
| -rw-r--r-- | src/commands/random_teawie.rs | 17 |
5 files changed, 53 insertions, 56 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 08cfc3d..b6130ab 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -2,9 +2,7 @@ pub mod ask; pub mod bing; pub mod convert; pub mod copypasta; -pub mod random_lore; -pub mod random_shiggy; -pub mod random_teawie; +pub mod random; pub mod teawiespam; pub mod version; @@ -16,9 +14,7 @@ pub fn to_global_commands() -> Vec<Command<Data, Error>> { ask::ask(), bing::bing(), convert::convert(), - random_lore::random_lore(), - random_shiggy::random_shiggy(), - random_teawie::random_teawie(), + random::random(), copypasta::copypasta(), teawiespam::teawiespam(), version::version(), 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) + } + } +} diff --git a/src/commands/random_lore.rs b/src/commands/random_lore.rs deleted file mode 100644 index 875a35e..0000000 --- a/src/commands/random_lore.rs +++ /dev/null @@ -1,16 +0,0 @@ -use crate::{consts, utils, Context, Error}; - -/// get a random piece of teawie lore! -#[poise::command(prefix_command, slash_command)] -pub async fn random_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) - } - } -} diff --git a/src/commands/random_shiggy.rs b/src/commands/random_shiggy.rs deleted file mode 100644 index e509a71..0000000 --- a/src/commands/random_shiggy.rs +++ /dev/null @@ -1,17 +0,0 @@ -use crate::api::shiggy::get_random_shiggy; -use crate::{Context, Error}; - -/// 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) - } - } -} diff --git a/src/commands/random_teawie.rs b/src/commands/random_teawie.rs deleted file mode 100644 index 8dcc76b..0000000 --- a/src/commands/random_teawie.rs +++ /dev/null @@ -1,17 +0,0 @@ -use crate::api::guzzle::get_random_teawie; -use crate::{Context, Error}; - -/// get a random teawie -#[poise::command(prefix_command, slash_command)] -pub async fn random_teawie(ctx: Context<'_>) -> Result<(), Error> { - match 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) - } - } -} |
