Skip to content

Commit

Permalink
Fix unrecognised_command() not working if the last added group has …
Browse files Browse the repository at this point in the history
…prefixes (#867)
  • Loading branch information
vicky5124 committed May 19, 2020
1 parent 2418edd commit 8040fa5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/framework/standard/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ pub fn command(
}

let mut last = Err(ParseError::UnrecognisedCommand(None));
let mut is_prefixless = false;

for (group, map) in groups {
match map {
Expand All @@ -354,7 +355,9 @@ pub fn command(
return res;
}

last = res;
if !is_prefixless {
last = res;
}
}
Map::Prefixless(subgroups, commands) => {
let res = handle_group(stream, ctx, msg, config, subgroups);
Expand All @@ -370,6 +373,7 @@ pub fn command(
if res.is_ok() {
check_discrepancy(ctx, msg, config, &group.options)?;

is_prefixless = true;
return res;
}

Expand Down

0 comments on commit 8040fa5

Please sign in to comment.