1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-11-20 10:13:03 +01:00

added fail command

This commit is contained in:
Jonas Leder 2020-06-22 17:18:18 +02:00
parent 80df9fd352
commit 50f845afbc

29
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):
@ -415,10 +415,19 @@ async def cat(ctx):
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
r = get(answer["url"])#get the url to the dog
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
await ctx.send(file=discord.File(image_data, 'dog.jpg'))#send the dog image
@bot.command(pass_context=True, brief="sends a random fail gif")
async def fail(ctx):
r = get("https://api.giphy.com/v1/gifs/random?api_key=0UTRbFtkMxAplrohufYco5IY74U8hOes&tag=fail&pg-13") # get random fail image
answer = loads(r.text)
r = get(answer["data"]["images"]["downsized_medium"]["url"])#get the url to the fail
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, 'fail.gif'))#send the fail image
# ___ ___ _ ______ _
# | \/ | (_) | ___ \ | |
# | . . | _ _ ___ _ ___ | |_/ / ___ | |_