diff options
| author | 2018-09-27 12:08:07 +0100 | |
|---|---|---|
| committer | 2018-09-27 12:08:07 +0100 | |
| commit | 6eb8b1ba6d9aaaf7df42f3d705149f02b6a1b871 (patch) | |
| tree | ece91b1c4d871d5d2b9a3f6319598e33aa13f93f /modules/youtube.py | |
| parent | Use ModuleManager.BaseModule in more modules (diff) | |
Move all exports to @Utils.export calls
Diffstat (limited to 'modules/youtube.py')
| -rw-r--r-- | modules/youtube.py | 15 |
1 files changed, 5 insertions, 10 deletions
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"]}, |
