From c5785a2d1484a98616b0fb8b5a7cb728eb094435 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Jun 2019 14:37:26 +0100 Subject: implement @utils.kwarg() magic, use it for command.regex hooks --- modules/imgur.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'modules/imgur.py') diff --git a/modules/imgur.py b/modules/imgur.py index 2cccaac6..fd68ed00 100644 --- a/modules/imgur.py +++ b/modules/imgur.py @@ -28,19 +28,20 @@ class Module(ModuleManager.BaseModule): text += "%s " % data["account_url"] return text - @utils.hook("command.regex", pattern=REGEX_IMAGE, ignore_action=False) + @utils.hook("command.regex") + @utils.kwarg("ignore_action", False) + @utils.kwarg("command", "imgur") + @utils.kwarg("pattern", REGEX_IMAGE) def _regex_image(self, event): - """ - :command: imgur - """ if event["target"].get_setting("auto-imgur", False): event["stdout"].write(self._parse_image(event["match"].group(1))) event.eat() - @utils.hook("command.regex", pattern=REGEX_GALLERY, ignore_action=False) + + @utils.hook("command.regex") + @utils.kwarg("ignore_action", False) + @utils.kwarg("command", "imgur") + @utils.kwarg("pattern", REGEX_GALLERY) def _regex_gallery(self, event): - """ - :command: imgur - """ if event["target"].get_setting("auto-imgur", False): event["stdout"].write(self._parse_gallery(event["match"].group(1))) event.eat() -- cgit v1.3.1-10-gc9f91