From 6eb8b1ba6d9aaaf7df42f3d705149f02b6a1b871 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 27 Sep 2018 12:08:07 +0100 Subject: Move all exports to @Utils.export calls --- modules/youtube.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'modules/youtube.py') diff --git a/modules/youtube.py b/modules/youtube.py index 10766c9c..9f5bdc77 100644 --- a/modules/youtube.py +++ b/modules/youtube.py @@ -1,7 +1,7 @@ #--require-config google-api-key import re -from src import Utils +from src import ModuleManager, Utils REGEX_YOUTUBE = re.compile( "https?://(?:www.)?(?:youtu.be/|youtube.com/watch\?[\S]*v=)([\w\-]{11})", @@ -16,15 +16,10 @@ URL_YOUTUBESHORT = "https://youtu.be/%s" ARROW_UP = "▲" ARROW_DOWN = "▼" -class Module(object): - def __init__(self, bot, events, exports): - self.bot = bot - self.events = events - - exports.add("channelset", {"setting": "auto-youtube", - "help": "Disable/Enable automatically getting info from " - "youtube URLs", "validate": Utils.bool_or_none}) - +@Utils.export("channelset", {"setting": "auto-youtube", + "help": "Disable/Enable automatically getting info from youtube URLs", + "validate": Utils.bool_or_none}) +class Module(ModuleManager.BaseModule): def get_video_page(self, video_id, part): return Utils.get_url(URL_YOUTUBEVIDEO, get_params={"part": part, "id": video_id, "key": self.bot.config["google-api-key"]}, -- cgit v1.3.1-10-gc9f91