From c397cd8db2dad9629dc0ef237ced91f8a4dcb3e5 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Mon, 9 Dec 2019 15:23:16 -0500 Subject: [PATCH] Bug where votes called with one option does not error out --- youmubot/src/commands/fun/votes.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/youmubot/src/commands/fun/votes.rs b/youmubot/src/commands/fun/votes.rs index 7bc8c22..4610b9e 100644 --- a/youmubot/src/commands/fun/votes.rs +++ b/youmubot/src/commands/fun/votes.rs @@ -37,15 +37,15 @@ pub fn vote(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult { ) } else { let choices: Vec<_> = args.iter().map(|v| v.unwrap()).collect(); + if choices.len() < 2 { + // Where are the choices? + msg.reply( + ctx, + "😒 Can't have a nice voting session if you only have one choice.", + )?; + return Ok(()); + } if choices.len() > MAX_CHOICES { - if choices.len() < 2 { - // Where are the choices? - msg.reply( - ctx, - "😒 Can't have a nice voting session if you only have one choice.", - )?; - return Ok(()); - } // Too many choices! msg.reply( ctx,