Correct a couple errors
This commit is contained in:
parent
2770d49b07
commit
1c0c7fa053
|
@ -23,11 +23,17 @@ class Images(commands.Cog):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
image = await utils.download_image(result)
|
image = await utils.download_image(result)
|
||||||
f = discord.File(image, filename=result.name)
|
|
||||||
await ctx.send(file=f)
|
|
||||||
except (ValueError, AttributeError):
|
except (ValueError, AttributeError):
|
||||||
await ctx.send("I couldn't connect! Sorry no cats right now ;w;")
|
await ctx.send("I couldn't connect! Sorry no cats right now ;w;")
|
||||||
|
|
||||||
|
f = discord.File(image, filename=result.name)
|
||||||
|
try:
|
||||||
|
await ctx.send(file=f)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await ctx.send(
|
||||||
|
f"File to large to send as attachment, here is the URL: {url}"
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command(aliases=['dog', 'rd'])
|
@commands.command(aliases=['dog', 'rd'])
|
||||||
@utils.can_run(send_messages=True)
|
@utils.can_run(send_messages=True)
|
||||||
async def doggo(self, ctx):
|
async def doggo(self, ctx):
|
||||||
|
@ -45,7 +51,12 @@ class Images(commands.Cog):
|
||||||
|
|
||||||
image = await utils.download_image(url)
|
image = await utils.download_image(url)
|
||||||
f = discord.File(image, filename=filename)
|
f = discord.File(image, filename=filename)
|
||||||
await ctx.send(file=f)
|
try:
|
||||||
|
await ctx.send(file=f)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await ctx.send(
|
||||||
|
f"File to large to send as attachment, here is the URL: {url}"
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command(aliases=['snake'])
|
@commands.command(aliases=['snake'])
|
||||||
@utils.can_run(send_messages=True)
|
@utils.can_run(send_messages=True)
|
||||||
|
@ -68,7 +79,12 @@ class Images(commands.Cog):
|
||||||
image = await utils.download_image(filename)
|
image = await utils.download_image(filename)
|
||||||
filename = re.search('.*/optimized/large/(.*)', filename).group(1)
|
filename = re.search('.*/optimized/large/(.*)', filename).group(1)
|
||||||
f = discord.File(image, filename=filename)
|
f = discord.File(image, filename=filename)
|
||||||
await ctx.send(file=f)
|
try:
|
||||||
|
await ctx.send(file=f)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await ctx.send(
|
||||||
|
f"File to large to send as attachment, here is the URL: {url}"
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@utils.can_run(send_messages=True)
|
@utils.can_run(send_messages=True)
|
||||||
|
@ -91,7 +107,12 @@ class Images(commands.Cog):
|
||||||
image = await utils.download_image(filename)
|
image = await utils.download_image(filename)
|
||||||
filename = re.search('.*/optimized/large/(.*)', filename).group(1)
|
filename = re.search('.*/optimized/large/(.*)', filename).group(1)
|
||||||
f = discord.File(image, filename=filename)
|
f = discord.File(image, filename=filename)
|
||||||
await ctx.send(file=f)
|
try:
|
||||||
|
await ctx.send(file=f)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await ctx.send(
|
||||||
|
f"File to large to send as attachment, here is the URL: {url}"
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|
|
@ -192,12 +192,18 @@ class TicTacToe(commands.Cog):
|
||||||
# Handle updating ratings based on the winner and loser
|
# Handle updating ratings based on the winner and loser
|
||||||
await utils.update_records('tictactoe', ctx.bot.db, winner, loser)
|
await utils.update_records('tictactoe', ctx.bot.db, winner, loser)
|
||||||
# This game has ended, delete it so another one can be made
|
# This game has ended, delete it so another one can be made
|
||||||
del self.boards[ctx.message.guild.id]
|
try:
|
||||||
|
del self.boards[ctx.message.guild.id]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
# If no one has won, make sure the game is not full. If it has, delete the board and say it was a tie
|
# If no one has won, make sure the game is not full. If it has, delete the board and say it was a tie
|
||||||
if board.full():
|
if board.full():
|
||||||
await ctx.send("This game has ended in a tie!")
|
await ctx.send("This game has ended in a tie!")
|
||||||
del self.boards[ctx.message.guild.id]
|
try:
|
||||||
|
del self.boards[ctx.message.guild.id]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
# If no one has won, and the game has not ended in a tie, print the new updated board
|
# If no one has won, and the game has not ended in a tie, print the new updated board
|
||||||
else:
|
else:
|
||||||
player_turn = board.challengers.get('x') if board.X_turn else board.challengers.get('o')
|
player_turn = board.challengers.get('x') if board.X_turn else board.challengers.get('o')
|
||||||
|
|
Loading…
Reference in a new issue