From e2e2a0903d344a6c90ce3bbe19b36df058e2f399 Mon Sep 17 00:00:00 2001 From: nitsuga5124 Date: Mon, 18 May 2020 05:59:40 +0200 Subject: [PATCH 1/2] Fixed unrecognised_command() not triggering when the last group in the standard framework has a prefix. modified: src/framework/standard/parse/mod.rs --- src/framework/standard/parse/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/framework/standard/parse/mod.rs b/src/framework/standard/parse/mod.rs index 76de70cb6e3..6a77c634433 100644 --- a/src/framework/standard/parse/mod.rs +++ b/src/framework/standard/parse/mod.rs @@ -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 { @@ -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); @@ -371,6 +374,7 @@ pub fn command( check_discrepancy(ctx, msg, config, &group.options)?; return res; + is_prefixless = true; } last = res; From 2fe30fa586027f6fd4e9d54c623f38c43cfda703 Mon Sep 17 00:00:00 2001 From: nitsuga5124 Date: Tue, 19 May 2020 02:25:27 +0200 Subject: [PATCH 2/2] Fixed return before modification. Update src/framework/standard/parse/mod.rs Co-authored-by: Alex M. M. --- src/framework/standard/parse/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/framework/standard/parse/mod.rs b/src/framework/standard/parse/mod.rs index 6a77c634433..06b59c1d75c 100644 --- a/src/framework/standard/parse/mod.rs +++ b/src/framework/standard/parse/mod.rs @@ -373,8 +373,8 @@ pub fn command( if res.is_ok() { check_discrepancy(ctx, msg, config, &group.options)?; - return res; is_prefixless = true; + return res; } last = res;