From 02e76444d17f02e152411d6ceafd43e0e2e68cae Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 3 Oct 2018 17:01:10 +0100 Subject: Add 'remove_empty' kwarg for commands, to strip out empty space --- modules/commands.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/commands.py') diff --git a/modules/commands.py b/modules/commands.py index 3660beb7..fbe4eb23 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -140,7 +140,11 @@ class Module(ModuleManager.BaseModule): stderr.write(returned).send() target.buffer.skip_next() return + args_split = event["message_split"][args_index:] + if hook.kwargs.get("remove_empty", True): + args_split = list(filter(None, args_split)) + min_args = hook.kwargs.get("min_args") if min_args and len(args_split) < min_args: if "usage" in hook.kwargs: -- cgit v1.3.1-10-gc9f91