From b778ad290214b9470a1987e18099c8ee8d447d1d Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 4 Oct 2018 11:04:24 +0100 Subject: Support denoting command response [prefix] in docstring --- modules/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/commands.py') diff --git a/modules/commands.py b/modules/commands.py index f7390ad4..8eb0b96b 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -124,8 +124,8 @@ class Module(ModuleManager.BaseModule): if is_channel and hook.kwargs.get("private_only"): return - module_name = "" - if hasattr(hook.function, "__self__"): + module_name = self._get_prefix(hook) or "" + if not module_name and hasattr(hook.function, "__self__"): module_name = hook.function.__self__._name msgid = event["tags"].get("draft/msgid", None) @@ -195,6 +195,8 @@ class Module(ModuleManager.BaseModule): return hook.get_kwarg("help", None) or hook.docstring.description def _get_usage(self, hook): return hook.get_kwarg("usage", None) + def _get_prefix(self, hook): + return hook.get_kwarg("prefix", None) @utils.hook("received.command.help") def help(self, event): -- cgit v1.3.1-10-gc9f91