feat: ping and roll

This commit is contained in:
Alzalia 2025-08-31 16:31:19 +02:00
parent 342bf5ea2d
commit 4092724586
8 changed files with 2621 additions and 2 deletions

3
src/commands/fun/mod.rs Normal file
View file

@ -0,0 +1,3 @@
pub mod age;
pub mod ping;
pub mod roll;

10
src/commands/fun/ping.rs Normal file
View file

@ -0,0 +1,10 @@
use crate::{Context, Error};
/// Displays your or another user's account creation date
#[poise::command(slash_command, prefix_command)]
pub async fn ping(ctx: Context<'_>) -> Result<(), Error> {
let response = format!("pong {} !", ctx.author().display_name());
ctx.reply(response).await?;
Ok(())
}

16
src/commands/fun/roll.rs Normal file
View 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(())
}