Fixed a bug with identifying a unique command index (should be 1-N, not 0-(N-1)).

This commit is contained in:
Griatch 2016-01-19 21:23:51 +01:00
parent 8655f880f2
commit 0ae1f9f171

View file

@ -122,10 +122,10 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
quality = [mat[4] for mat in matches]
matches = matches[-quality.count(quality[-1]):]
if len(matches) > 1 and match_index != None and 0 <= match_index < len(matches):
if len(matches) > 1 and match_index != None and 0 < match_index <= len(matches):
# We couldn't separate match by quality, but we have an
# index argument to tell us which match to use.
matches = [matches[match_index]]
matches = [matches[match_index-1]]
# no matter what we have at this point, we have to return it.
return matches