+35
src/commands/fun/height.rs
+35
src/commands/fun/height.rs
···
1
+
use crate::types::Context;
2
+
use color_eyre::eyre::Result;
3
+
use poise::serenity_prelude::User;
4
+
use rand::Rng;
5
+
6
+
#[poise::command(slash_command)]
7
+
pub async fn height(
8
+
ctx: Context<'_>,
9
+
#[description = "Selected user"] user: Option<User>,
10
+
) -> Result<()> {
11
+
let user = user.as_ref().unwrap_or_else(|| ctx.author());
12
+
13
+
let (feet, inches, cm) = match user.id.get() {
14
+
463566237918691338 => (8, 5, 256),
15
+
474274492810788864 => (4, 1, 124),
16
+
_ => {
17
+
let total_inches = rand::rng().random_range(49..=101);
18
+
let feet = total_inches / 12;
19
+
let inches = total_inches % 12;
20
+
let cm = (total_inches as f32 * 2.54) as u32;
21
+
(feet, inches, cm)
22
+
}
23
+
};
24
+
25
+
ctx.say(format!(
26
+
"🔮 **{}** is **{}'{}\"** (**{} cm**) tall!",
27
+
user.display_name(),
28
+
feet,
29
+
inches,
30
+
cm
31
+
))
32
+
.await?;
33
+
34
+
Ok(())
35
+
}
+2
-1
src/commands/fun/mod.rs
+2
-1
src/commands/fun/mod.rs