diff options
| author | 2018-10-04 11:04:24 +0100 | |
|---|---|---|
| committer | 2018-10-04 11:04:24 +0100 | |
| commit | b778ad290214b9470a1987e18099c8ee8d447d1d (patch) | |
| tree | 9e91f99ee4b688a1245b9dd8316cc932b551e1e9 /modules/commands.py | |
| parent | Also catch gaierror in !rdns, print e.strerror instead of str(e) (diff) | |
| signature | ||
Support denoting command response [prefix] in docstring
Diffstat (limited to 'modules/commands.py')
| -rw-r--r-- | modules/commands.py | 6 |
1 files changed, 4 insertions, 2 deletions
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): |
