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/youtube.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'modules/youtube.py') diff --git a/modules/youtube.py b/modules/youtube.py index 2b89d021..f31b15ec 100644 --- a/modules/youtube.py +++ b/modules/youtube.py @@ -130,14 +130,12 @@ class Module(ModuleManager.BaseModule): else: event["stderr"].write("No search phrase provided") - @utils.hook("command.regex", ignore_action=False, - priority=EventManager.PRIORITY_LOW) + @utils.hook("command.regex") + @utils.kwarg("priority", EventManager.PRIORITY_LOW) + @utils.kwarg("ignore_action", False) + @utils.kwarg("command", "youtube") + @utils.kwarg("pattern", REGEX_YOUTUBE) def channel_message(self, event): - """ - :command: youtube - :-pattern: https?://(?:www.)? - (?:youtu.be/|youtube.com/watch\?[\S]*v=)([\w\-]{11}) - """ if event["target"].get_setting("auto-youtube", False): youtube_id = event["match"].group(1) video_details = self.video_details(youtube_id) -- cgit v1.3.1-10-gc9f91