1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 06:37:29 +00:00

Merge branch 'dev'

This commit is contained in:
Dylan Dizon 2018-11-26 18:54:21 -05:00
commit 3f018dd6e9
3 changed files with 38 additions and 37 deletions

View file

@ -304,7 +304,7 @@ class MsG:
icon_url=self._get_score(post['score'])) icon_url=self._get_score(post['score']))
except exc.MissingArgument: except exc.MissingArgument:
await ctx.send('**Invalid url**') await ctx.send('\N{CROSS MARK} **Invalid url**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get.command(name='image', aliases=['img'], brief='(get) Get direct image from post', description='Return direct image URL for given post\n\nExample:\n\{p\}get image 1145042') @get.command(name='image', aliases=['img'], brief='(get) Get direct image from post', description='Return direct image URL for given post\n\nExample:\n\{p\}get image 1145042')
@ -331,7 +331,7 @@ class MsG:
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.MissingArgument: except exc.MissingArgument:
await ctx.send('**Invalid url or file**') await ctx.send('\N{CROSS MARK} **Invalid url or file**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get.command(name='pool', aliases=['p'], brief='(get) Get pool from query', description='Return pool info for given query\n\nExample:\n\{p\}get pool 1145042') @get.command(name='pool', aliases=['p'], brief='(get) Get pool from query', description='Return pool info for given query\n\nExample:\n\{p\}get pool 1145042')
@ -423,7 +423,7 @@ class MsG:
await ctx.message.delete() await ctx.message.delete()
except exc.MissingArgument: except exc.MissingArgument:
await ctx.send('**Invalid url or file.** Be sure the link directs to an image file') await ctx.send('\N{CROSS MARK} **Invalid url or file.** Be sure the link directs to an image file')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.SizeError as e: except exc.SizeError as e:
await ctx.send(f'`{e}` **too large.** Maximum is 8 MB') await ctx.send(f'`{e}` **too large.** Maximum is 8 MB')
@ -1417,7 +1417,7 @@ class MsG:
usage='[blacklist]') usage='[blacklist]')
async def get_blacklist(self, ctx): async def get_blacklist(self, ctx):
if not ctx.invoked_subcommand: if not ctx.invoked_subcommand:
await ctx.send('**Invalid blacklist**') await ctx.send('\N{CROSS MARK} **Invalid blacklist**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get_blacklist.command( @get_blacklist.command(
@ -1483,7 +1483,7 @@ class MsG:
usage='[blacklist] [tags...]') usage='[blacklist] [tags...]')
async def add_tags(self, ctx): async def add_tags(self, ctx):
if not ctx.invoked_subcommand: if not ctx.invoked_subcommand:
await ctx.send('**Invalid blacklist**') await ctx.send('\N{CROSS MARK} **Invalid blacklist**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
async def _add(self, tags, lst, alias=False): async def _add(self, tags, lst, alias=False):
@ -1586,7 +1586,7 @@ class MsG:
usage='[blacklist] [tags...]') usage='[blacklist] [tags...]')
async def remove_tags(self, ctx): async def remove_tags(self, ctx):
if not ctx.invoked_subcommand: if not ctx.invoked_subcommand:
await ctx.send('**Invalid blacklist**') await ctx.send('\N{CROSS MARK} **Invalid blacklist**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
def _remove(self, remove, lst): def _remove(self, remove, lst):
@ -1684,7 +1684,7 @@ class MsG:
usage='[blacklist]') usage='[blacklist]')
async def clear_blacklist(self, ctx): async def clear_blacklist(self, ctx):
if not ctx.invoked_subcommand: if not ctx.invoked_subcommand:
await ctx.send('**Invalid blacklist**') await ctx.send('\N{CROSS MARK} **Invalid blacklist**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@clear_blacklist.command( @clear_blacklist.command(

View file

@ -159,6 +159,7 @@ async def on_error(error, *args, **kwargs):
@bot.event @bot.event
async def on_command_error(ctx, error): async def on_command_error(ctx, error):
with suppress(err.NotFound):
if isinstance(error, errext.CommandOnCooldown): if isinstance(error, errext.CommandOnCooldown):
await ctx.message.add_reaction('\N{HOURGLASS}') await ctx.message.add_reaction('\N{HOURGLASS}')
await asyncio.sleep(error.retry_after) await asyncio.sleep(error.retry_after)

View file

@ -16,7 +16,7 @@ async def get_post(url):
if filesize > 8192 * 1024: if filesize > 8192 * 1024:
raise exc.SizeError(size(filesize, system=alternative)) raise exc.SizeError(size(filesize, system=alternative))
except ValueError: except (ValueError, KeyError):
raise exc.MissingArgument raise exc.MissingArgument
content = await u.fetch('http://iqdb.harry.lu', params={'url': url}) content = await u.fetch('http://iqdb.harry.lu', params={'url': url})