mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 20:36:10 +01:00
34 lines
663 B
Rust
34 lines
663 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 _ = {
|
|
let mut rng = rand::thread_rng();
|
|
|
|
dice = rng.gen_range(1..7);
|
|
};
|
|
|
|
ctx.send(
|
|
CreateReply::default().embed(
|
|
embed(
|
|
ctx,
|
|
"Let's roll the dice!",
|
|
"",
|
|
&format!("Your number is: {}", dice),
|
|
)
|
|
.await
|
|
.unwrap(),
|
|
),
|
|
)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|