From 11f7ebaa863a2907e58e978e1ad421f5b96fd9ec Mon Sep 17 00:00:00 2001 From: dongfix Date: Sun, 9 Sep 2018 01:19:00 +0100 Subject: Add channel prefix to .usage (So it shows .8ball instead of just 8ball , based on the channel's prefix) Updated ducks.py, more efficient code and style tweaks. --- modules/commands.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/commands.py') diff --git a/modules/commands.py b/modules/commands.py index 6cac8c43..fcd12847 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -190,12 +190,20 @@ class Module(object): event["stdout"].write("Commands: %s" % ", ".join(help_available)) def usage(self, event): + command_prefix = event["target"].get_setting("command-prefix", + event["server"].get_setting( + "command-prefix", + "!")) + command = event["args_split"][0].lower() if command in self.events.on("received").on( "command").get_children(): hooks = self.events.on("received").on("command").on(command).get_hooks() if hooks and "usage" in hooks[0].kwargs: - event["stdout"].write("Usage: %s %s" % (command, hooks[0].kwargs["usage"])) + event["stdout"].write("Usage: %s%s %s" % (command_prefix, + command, + hooks[0].kwargs[ + "usage"])) else: event["stderr"].write("No usage help available for %s" % command) else: -- cgit v1.3.1-10-gc9f91