changed commands.py to show usage help (if available) when minimum arguments are not met.
This commit is contained in:
parent
842de08b47
commit
1750c2b1ec
1 changed files with 6 additions and 2 deletions
|
@ -108,8 +108,12 @@ class Module(object):
|
|||
args_split = list(filter(None, event["message_split"][args_index:]))
|
||||
min_args = hook.kwargs.get("min_args")
|
||||
if min_args and len(args_split) < min_args:
|
||||
stderr.write("Not enough arguments (minimum: %d)" % min_args
|
||||
).send()
|
||||
if "usage" in hook.kwargs:
|
||||
stderr.write("Not enough arguments, usage: %s %s" % (
|
||||
command, hook.kwargs["usage"])).send()
|
||||
else:
|
||||
stderr.write("Not enough arguments (minimum: %d)" % min_args
|
||||
).send()
|
||||
else:
|
||||
args = " ".join(args_split)
|
||||
server = event["server"]
|
||||
|
|
Loading…
Reference in a new issue