Testing/CI #21
-29
@@ -377,35 +377,6 @@ class Shitpost(commands.Cog):
|
|||||||
print("No permission to delete message")
|
print("No permission to delete message")
|
||||||
yield from ctx.channel.send(ctx.author.mention, embed=em)
|
yield from ctx.channel.send(ctx.author.mention, embed=em)
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
|
||||||
@asyncio.coroutine
|
|
||||||
def relevantxkcd(self, ctx, query: str):
|
|
||||||
"""There is always a relevant XKCD
|
|
||||||
Bijvoorbeeld:
|
|
||||||
!relevantxkcd python
|
|
||||||
"""
|
|
||||||
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)
|
|
||||||
|
|
||||||
em = discord.Embed(title='', type='photo')
|
|
||||||
em.set_image(url=photoUrl)
|
|
||||||
|
|
||||||
try:
|
|
||||||
yield from ctx.message.delete()
|
|
||||||
except:
|
|
||||||
print("No permission to delete message")
|
|
||||||
yield from ctx.channel.send(ctx.author.mention +
|
|
||||||
' een XKCD over "' + query + '"', embed=em)
|
|
||||||
|
|
||||||
@commands.command(pass_context=True, hidden=True)
|
@commands.command(pass_context=True, hidden=True)
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def zout(self, ctx, boven: str, onder: str):
|
def zout(self, ctx, boven: str, onder: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user