Better indentation in commands.py

This commit is contained in:
jesopo 2018-09-09 09:06:17 +01:00
parent dacf8998eb
commit 572ea85f1e

View file

@ -190,14 +190,10 @@ class Module(object):
event["stdout"].write("Commands: %s" % ", ".join(help_available)) event["stdout"].write("Commands: %s" % ", ".join(help_available))
def usage(self, event): def usage(self, event):
command_prefix = ""
if event["is_channel"]: if event["is_channel"]:
command_prefix = event["target"].get_setting("command-prefix", command_prefix = event["target"].get_setting("command-prefix",
event["server"].get_setting( event["server"].get_setting("command-prefix", "!"))
"command-prefix",
"!"))
else:
command_prefix = ""
command = event["args_split"][0].lower() command = event["args_split"][0].lower()
if command in self.events.on("received").on( if command in self.events.on("received").on(
@ -205,9 +201,7 @@ class Module(object):
hooks = self.events.on("received").on("command").on(command).get_hooks() hooks = self.events.on("received").on("command").on(command).get_hooks()
if hooks and "usage" in hooks[0].kwargs: if hooks and "usage" in hooks[0].kwargs:
event["stdout"].write("Usage: %s%s %s" % (command_prefix, event["stdout"].write("Usage: %s%s %s" % (command_prefix,
command, command, hooks[0].kwargs["usage"]))
hooks[0].kwargs[
"usage"]))
else: else:
event["stderr"].write("No usage help available for %s" % command) event["stderr"].write("No usage help available for %s" % command)
else: else: