mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 16:28:55 +00:00
Bug where votes called with one option does not error out
This commit is contained in:
parent
ea7c6d8072
commit
c397cd8db2
1 changed files with 8 additions and 8 deletions
|
@ -37,15 +37,15 @@ pub fn vote(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let choices: Vec<_> = args.iter().map(|v| v.unwrap()).collect();
|
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() > 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!
|
// Too many choices!
|
||||||
msg.reply(
|
msg.reply(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
Loading…
Add table
Reference in a new issue