diff options
Diffstat (limited to 'modules/spotify.py')
| -rw-r--r-- | modules/spotify.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/spotify.py b/modules/spotify.py index 64ba2c2f..9b69523d 100644 --- a/modules/spotify.py +++ b/modules/spotify.py @@ -3,6 +3,7 @@ import Utils URL_SPOTIFY = "https://api.spotify.com/v1/search" + class Module(object): def __init__(self, bot): bot.events.on("received").on("command").on("spotify").hook( @@ -11,7 +12,9 @@ class Module(object): def spotify(self, event): page = Utils.get_url(URL_SPOTIFY, get_params={"type": "track", - "limit": 1, "q": event["args"]}, json=True) + "limit": 1, + "q": event["args"]}, + json=True) if page: if len(page["tracks"]["items"]): item = page["tracks"]["items"][0] @@ -19,7 +22,7 @@ class Module(object): artist_name = item["artists"][0]["name"] url = item["external_urls"]["spotify"] event["stdout"].write("%s (by %s) %s" % (title, artist_name, - url)) + url)) else: event["stderr"].write("No results found") else: |
