1
0
Fork 0
mirror of synced 2024-09-29 08:51:53 +13:00

Corrected what was checked for the length of the search

This commit is contained in:
Phxntxm 2016-08-15 15:44:13 -05:00
parent 934ccb6d86
commit 121e13e623

View file

@ -22,7 +22,7 @@ class Links:
base_url = "https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch="
async with self.session.get("{}/{}".format(base_url, query), headers=self.headers) as r:
data = await r.json()
if len(data['query']['search'] == 0):
if len(data['query']['search']) == 0:
await self.bot.say("I could not find any results with that term, I tried my best :c")
return
url = "https://en.wikipedia.org/wiki/{}".format(data['query']['search'][0]['title'].replace(' ', '%20'))