1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-06-13 21:58:20 +02:00

documentation for cat

This commit is contained in:
Jonas Leder 2020-06-22 16:49:58 +02:00
parent af927eced1
commit 54a0b1a22a

10
bot.py
View file

@ -402,14 +402,14 @@ async def result(ctx, id):#this function prints the result of a poll
#
#
@bot.command(pass_context=True, brief="sends a random cat picture")
@bot.command(pass_context=True, brief="sends a random cat image")
async def cat(ctx):
r = get("http://aws.random.cat/meow")
r = get("http://aws.random.cat/meow") # get random cat image
answer = loads(r.text)
r = get(answer["file"])
image_data = BytesIO(r.content)
r = get(answer["file"])#get the url to the cat
image_data = BytesIO(r.content)#download tthe image and load it into BytesIO
image_data.seek(0)
await ctx.send(file=discord.File(image_data, 'cat.jpg'))
await ctx.send(file=discord.File(image_data, 'cat.jpg'))#send the cat image
# ___ ___ _ ______ _
# | \/ | (_) | ___ \ | |
# | . . | _ _ ___ _ ___ | |_/ / ___ | |_