From 1750c2b1ec87d40ac4606ba86ef990455873d3f7 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 10 Apr 2016 17:31:55 +0100 Subject: [PATCH] changed commands.py to show usage help (if available) when minimum arguments are not met. --- modules/commands.py | 8 ++++++-- 1 file 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"]