Really fix parsing bug

This commit is contained in:
Jeff 2024-06-16 19:33:16 -04:00
parent 7959ac54da
commit 15a0361083

View File

@ -282,6 +282,13 @@ impl Bot {
let max = word let max = word
.parse::<u64>() .parse::<u64>()
.map_err(|error| format!("Failed to parse integer: {error}"))?; .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); let random = thread_rng().gen_range(1..max);
match message.chat_type { match message.chat_type {