restructured cmds.rs to multiple files

This commit is contained in:
2025-06-05 23:15:55 +02:00
parent 823a354a6b
commit 7922bc50a9
14 changed files with 529 additions and 522 deletions
+31
View File
@@ -0,0 +1,31 @@
use rand::{seq::IteratorRandom, Rng};
use crate::{lang, messages::send_msg, Context, Error};
#[poise::command(
slash_command,
prefix_command,
category = "fun",
rename = "8_ball",
required_bot_permissions = "SEND_MESSAGES | VIEW_CHANNEL"
)]
/// Magic 8-ball. Ask a question, get an answer.
pub async fn cmd(
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,
lang!("dc_msg_8-ball_answer", question, rand_item.unwrap()),
true,
true
).await;
return Ok(());
}