diff options
| author | Lake Lezz <[email protected]> | 2018-08-06 23:45:15 +0200 |
|---|---|---|
| committer | Lake Lezz <[email protected]> | 2018-08-06 23:45:15 +0200 |
| commit | 5a9bf8673466e3049bff1b9c8d480d714bae8e06 (patch) | |
| tree | c86868512131220db6ef0090a0e07b0173242523 | |
| parent | Remove usage of inclusive range syntax (diff) | |
| download | serenity-5a9bf8673466e3049bff1b9c8d480d714bae8e06.tar.xz serenity-5a9bf8673466e3049bff1b9c8d480d714bae8e06.zip | |
Prevent sub-group-prefixes to picked.
| -rw-r--r-- | src/framework/standard/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index 4aa462e..dfaff3c 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -1043,8 +1043,9 @@ impl Framework for StandardFramework { // than the last matching one, this prevents picking a wrong prefix, // e.g. "f" instead of "ferris" due to "f" having a lower index in the `Vec`. let longest_matching_prefix_len = prefixes.iter().fold(0, |longest_prefix_len, prefix| - if prefix.len() > longest_prefix_len && built.starts_with(prefix) - && (orginal_round.len() == built.len() || command_length > prefix.len() + 1) { + if prefix.len() > longest_prefix_len + && built.starts_with(prefix) + && (orginal_round.len() == prefix.len() || built.get(prefix.len()..prefix.len() + 1) == Some(" ")) { prefix.len() } else { longest_prefix_len |