feat: ping and roll
This commit is contained in:
parent
342bf5ea2d
commit
4092724586
8 changed files with 2621 additions and 2 deletions
16
src/commands/fun/roll.rs
Normal file
16
src/commands/fun/roll.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use crate::{Context, Error};
|
||||
|
||||
use rand::prelude::*;
|
||||
|
||||
/// Displays your or another user's account creation date
|
||||
#[poise::command(slash_command, prefix_command)]
|
||||
pub async fn roll(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Le nombre de faces du dé"] faces: u64,
|
||||
) -> Result<(), Error> {
|
||||
let num = (1..faces).choose(&mut rand::rng()).unwrap_or(1);
|
||||
|
||||
let response = format!("Le dé à {} faces est tombé sur **{}**", faces, num);
|
||||
ctx.say(response).await?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue