Better .strip()/.split() logic for !help

This commit is contained in:
jesopo 2018-09-29 10:50:25 +01:00
parent c12e8220ac
commit 3dbd997a90

View file

@ -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: