diff options
| author | 2016-04-10 17:31:55 +0100 | |
|---|---|---|
| committer | 2016-04-10 17:31:55 +0100 | |
| commit | 1750c2b1ec87d40ac4606ba86ef990455873d3f7 (patch) | |
| tree | 7676a5c545919137994c3152a3c9084d1f8ee712 | |
| parent | changed code to avoid a crash when some ircd will show a mode being removed f... (diff) | |
changed commands.py to show usage help (if available) when minimum arguments are not met.
| -rw-r--r-- | modules/commands.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/commands.py b/modules/commands.py index 306a79ed..14713c2e 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -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"] |
