From 15a0361083792243e6b2928d1035c1d1d9d1693c Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 16 Jun 2024 19:33:16 -0400 Subject: [PATCH] Really fix parsing bug --- src/bot.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bot.rs b/src/bot.rs index 7e6e1f7..2d9808c 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -282,6 +282,13 @@ impl Bot { let max = word .parse::() .map_err(|error| format!("Failed to parse integer: {error}"))?; + + if max <= 1 { + return Err( + "Roll command did not receive an integer greater than 1".to_string() + ); + } + let random = thread_rng().gen_range(1..max); match message.chat_type {