Files
lyra/src/commands/tools/dice.rs
2024-08-08 20:46:22 +02:00

31 lines
643 B
Rust

use rand::Rng;
use poise::CreateReply;
use crate::{commands::embeds::embed, Context, Error};
/// Rolls a dice
#[poise::command(prefix_command, slash_command, category = "Tools")]
pub async fn dice(ctx: Context<'_>) -> Result<(), Error> {
let dice = {
let mut rng = rand::thread_rng();
rng.gen_range(1..=6)
};
ctx.send(
CreateReply::default().embed(
embed(
ctx,
"Let's roll the dice!",
"",
&format!("Your number is: {}", dice),
)
.await
.unwrap(),
),
)
.await?;
Ok(())
}