xkcd improvement
This commit is contained in:
+7
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user