summaryrefslogtreecommitdiff
path: root/src/commands/general/random.rs
blob: 094123beb1d56cea3ac9a077705b7dbbd3ed3158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::{client::Context, consts, http, utils};

use eyre::Result;

#[poise::command(slash_command, subcommands("lore", "teawie", "shiggy"))]
#[allow(clippy::unused_async)]
pub async fn random(_: Context<'_>) -> Result<()> {
	Ok(())
}

/// Get a random piece of teawie lore!
#[poise::command(prefix_command, slash_command)]
pub async fn lore(ctx: Context<'_>) -> Result<()> {
	let resp = utils::random_choice(consts::LORE)?;
	ctx.say(resp).await?;

	Ok(())
}

/// Get a random teawie
#[poise::command(prefix_command, slash_command)]
pub async fn teawie(ctx: Context<'_>) -> Result<()> {
	let url = http::teawie::random(&ctx.data().http_client).await?;
	utils::send_url_as_embed(ctx, url).await?;

	Ok(())
}

/// Get a random shiggy
#[poise::command(prefix_command, slash_command)]
pub async fn shiggy(ctx: Context<'_>) -> Result<()> {
	let url = http::shiggy::random(&ctx.data().http_client).await?;
	utils::send_url_as_embed(ctx, url).await?;

	Ok(())
}