From 3dbd997a90fcd032e44e5d7402249921ad041458 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 29 Sep 2018 10:50:25 +0100 Subject: [PATCH] Better .strip()/.split() logic for !help --- modules/commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/commands.py b/modules/commands.py index d98a7e23..6a37a31e 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -168,8 +168,12 @@ class Module(ModuleManager.BaseModule): help = self._get_help(hooks[0]) if help: - event["stdout"].write("%s: %s" % (command, " ".join( - [line.strip() for line in help.split("\n")]))) + help = [line.strip() for line in help.split("\n")] + help = [line.strip() for line in help] + help = filter(None, help) + help = " ".join(help) + + event["stdout"].write("%s: %s" % (command, help)) else: event["stderr"].write("No help available for %s" % command) else: