added /eight_ball command

This commit is contained in:
2025-02-01 00:49:13 +01:00
parent 1e548f5174
commit 94726df090
7 changed files with 66 additions and 5 deletions
+21
View File
@@ -1,6 +1,7 @@
use crate::{send_embed, send_msg, Context, EmbedOptions, Error};
use poise::serenity_prelude::{OnlineStatus, Timestamp};
use rand::{seq::IteratorRandom, Rng};
#[poise::command(slash_command, prefix_command)]
@@ -65,5 +66,25 @@ pub async fn embed(
}
).await?;
return Ok(());
}
#[poise::command(slash_command, prefix_command)]
pub async fn eight_ball(
ctx: Context<'_>,
#[description = "Question to ask."] question: String
) -> Result<(), Error>
{
let is_quirky = rand::rng().random_bool(0.2);
let list = &ctx.data().ball_prompts[if is_quirky { 1 } else { 0 }];
let rand_item = list.iter().choose(&mut rand::rng());
send_msg(
ctx,
format!("Q: {}\nA: {}", question, rand_item.unwrap()),
true
).await?;
return Ok(());
}