From 51a52e2b0e54031cce5876f54d1d48c268b5441c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 18:27:17 +0100 Subject: Switch to using @Utils.hook and docstrings for event hooks --- modules/spotify.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/spotify.py') diff --git a/modules/spotify.py b/modules/spotify.py index eef89b15..6816cd50 100644 --- a/modules/spotify.py +++ b/modules/spotify.py @@ -1,14 +1,14 @@ import json -from src import Utils +from src import ModuleManager, Utils URL_SPOTIFY = "https://api.spotify.com/v1/search" -class Module(object): - def __init__(self, bot, events, exports): - events.on("received.command.spotify").hook(self.spotify, min_args=1, - help="Search for a track on spotify") - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.spotify", min_args=1) def spotify(self, event): + """ + Search for a track on spotify + """ page = Utils.get_url(URL_SPOTIFY, get_params={"type": "track", "limit": 1, "q": event["args"]}, json=True) if page: -- cgit v1.3.1-10-gc9f91