diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/spotify.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
| signature | ||
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/spotify.py')
| -rw-r--r-- | modules/spotify.py | 12 |
1 files changed, 6 insertions, 6 deletions
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: |
