1
0
Fork 0
mirror of synced 2024-05-05 05:02:30 +12:00

Catch race condition

This commit is contained in:
phxntxm 2018-09-21 17:03:19 -05:00
parent fbb5873884
commit 4f8f606609

View file

@ -3,7 +3,6 @@ import discord
import random
import re
import math
import glob
from bs4 import BeautifulSoup as bs
from . import utils
@ -25,9 +24,12 @@ class Images:
opts = {"format": "src"}
result = await utils.request(url, attr='url', payload=opts)
image = await utils.download_image(result)
f = discord.File(image, filename=result.name)
await ctx.send(file=f)
try:
image = await utils.download_image(result)
f = discord.File(image, filename=result.name)
await ctx.send(file=f)
except (ValueError, AttributeError):
await ctx.send("I couldn't connect! Sorry no cats right now ;w;")
@commands.command(aliases=['dog', 'rd'])
@utils.custom_perms(send_messages=True)