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,6 +108,10 @@ class Module(object):
|
||||||
args_split = list(filter(None, event["message_split"][args_index:]))
|
args_split = list(filter(None, event["message_split"][args_index:]))
|
||||||
min_args = hook.kwargs.get("min_args")
|
min_args = hook.kwargs.get("min_args")
|
||||||
if min_args and len(args_split) < min_args:
|
if min_args and len(args_split) < min_args:
|
||||||
|
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
|
stderr.write("Not enough arguments (minimum: %d)" % min_args
|
||||||
).send()
|
).send()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue