1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Added error catching for SizeError

This commit is contained in:
Myned 2017-11-20 02:20:30 -05:00
parent a967eaedf0
commit 77687e93dd

View file

@ -357,7 +357,10 @@ class MsG:
await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.MissingArgument:
await ctx.send('**Invalid url or file** Be sure the link directs to an image file', delete_after=7)
await ctx.send('**Invalid url or file.** Be sure the link directs to an image file', delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.SizeError as e:
await ctx.send(f'`{e}` **too large.** Maximum is 8 MB', delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}')
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
@ -408,6 +411,10 @@ class MsG:
await ctx.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e), delete_after=7)
await message.add_reaction('\N{CROSS MARK}')
c -= 1
except exc.SizeError as e:
await ctx.send(f'`{e}` **too large.** Maximum is 8 MB', delete_after=7)
await message.add_reaction('\N{CROSS MARK}')
c -= 1
finally:
n += 1
@ -451,6 +458,9 @@ class MsG:
except exc.MatchError as e:
await message.channel.send('**No probable match for:** `{}`'.format(e), delete_after=7)
await message.add_reaction('\N{CROSS MARK}')
except exc.SizeError as e:
await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB', delete_after=7)
await message.add_reaction('\N{CROSS MARK}')
finally:
await asyncio.sleep(self.RATE_LIMIT)