1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-10-03 07:48:58 +02:00

added dog command

This commit is contained in:
Jonas Leder 2020-06-22 17:07:13 +02:00
parent 54a0b1a22a
commit 80df9fd352

25
bot.py
View file

@ -393,14 +393,14 @@ async def result(ctx, id):#this function prints the result of a poll
dbcursor.execute("DELETE FROM poll where pollID = ?", [id])#delete the entries from the poll in the database
dbconnection.commit()#write the database to disk
# _____ _
# / ____| | |
# | | __ _ | |_
# | | / _` || __|
# | |____| (_| || |_
# \_____|\__,_| \__|
#
#
# _ _
# /\ (_) | |
# / \ _ __ _ _ __ ___ __ _ | | ___
# / /\ \ | '_ \ | || '_ ` _ \ / _` || |/ __|
# / ____ \ | | | || || | | | | || (_| || |\__ \
# /_/ \_\|_| |_||_||_| |_| |_| \__,_||_||___/
#
#
@bot.command(pass_context=True, brief="sends a random cat image")
async def cat(ctx):
@ -410,6 +410,15 @@ async def cat(ctx):
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'))#send the cat image
@bot.command(pass_context=True, brief="sends a random dog image")
async def dog(ctx):
r = get("https://random.dog/woof.json") # get random dog image
answer = loads(r.text)
r = get(answer["url"])#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, 'dog.jpg'))#send the cat image
# ___ ___ _ ______ _
# | \/ | (_) | ___ \ | |
# | . . | _ _ ___ _ ___ | |_/ / ___ | |_