From 09b6f52d8ef6d875592c9a5aa1f42a228725a254 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 3 Oct 2018 17:01:26 +0100 Subject: Fix showing usage when a user doesn't provide enough args to a command --- modules/commands.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/commands.py b/modules/commands.py index fbe4eb23..f7390ad4 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -147,12 +147,13 @@ class Module(ModuleManager.BaseModule): min_args = hook.kwargs.get("min_args") if min_args and len(args_split) < min_args: - if "usage" in hook.kwargs: + usage = self._get_usage(hook) + if usage: stderr.write("Not enough arguments, usage: %s %s" % ( - command, hook.kwargs["usage"])).send() + command, usage)).send() else: - stderr.write("Not enough arguments (minimum: %d)" % min_args - ).send() + stderr.write("Not enough arguments (minimum: %d)" % + min_args).send() else: args = " ".join(args_split) server = event["server"] -- cgit v1.3.1-10-gc9f91