xkcd improvement

This commit is contained in:
JP
2018-02-13 21:22:51 +01:00
parent 4c7cb5d1af
commit a2f6840079
+7 -1
View File
@@ -106,6 +106,11 @@ class Shitpost(object):
response = requests.get("https://relevantxkcd.appspot.com/process?action=xkcd&query=" + query)
splitResponse = response.text.split(" ")
if (float(splitResponse[0]) == 0.0):
yield from ctx.channel.send('Ik kan helaas geen XKCD vinden met als onderwerp "' + query + '".')
return
photoUrl = "http://www.explainxkcd.com" + splitResponse[3]
print(photoUrl)
@@ -117,7 +122,8 @@ class Shitpost(object):
yield from ctx.message.delete()
except:
print("No permission to delete message")
yield from ctx.channel.send(ctx.author.mention, embed=em)
yield from ctx.channel.send(ctx.author.mention +
' een XKCD over "' + query + '"', embed=em)
@commands.command(pass_context=True, hidden=True)
@asyncio.coroutine