Correct error to catch when there's no result
This commit is contained in:
parent
8560f29e17
commit
fc2c5b5e5f
|
@ -51,7 +51,7 @@ class Spotify:
|
||||||
response = await utils.request(url, headers=headers, payload=opts)
|
response = await utils.request(url, headers=headers, payload=opts)
|
||||||
try:
|
try:
|
||||||
await ctx.send(response.get("tracks").get("items")[0].get("external_urls").get("spotify"))
|
await ctx.send(response.get("tracks").get("items")[0].get("external_urls").get("spotify"))
|
||||||
except (KeyError, AttributeError):
|
except (KeyError, AttributeError, IndexError):
|
||||||
await ctx.send("Couldn't find a song for:\n{}".format(query))
|
await ctx.send("Couldn't find a song for:\n{}".format(query))
|
||||||
|
|
||||||
@spotify.command()
|
@spotify.command()
|
||||||
|
|
Loading…
Reference in a new issue