1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +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']))
except exc.MissingArgument:
await ctx.send('**Invalid url**')
await ctx.send('\N{CROSS MARK} **Invalid url**')
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')
@ -331,7 +331,7 @@ class MsG:
await ctx.message.add_reaction('\N{CROSS MARK}')
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}')
@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()
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}')
except exc.SizeError as e:
await ctx.send(f'`{e}` **too large.** Maximum is 8 MB')
@ -1417,7 +1417,7 @@ class MsG:
usage='[blacklist]')
async def get_blacklist(self, ctx):
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}')
@get_blacklist.command(
@ -1483,7 +1483,7 @@ class MsG:
usage='[blacklist] [tags...]')
async def add_tags(self, ctx):
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}')
async def _add(self, tags, lst, alias=False):
@ -1586,7 +1586,7 @@ class MsG:
usage='[blacklist] [tags...]')
async def remove_tags(self, ctx):
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}')
def _remove(self, remove, lst):
@ -1684,7 +1684,7 @@ class MsG:
usage='[blacklist]')
async def clear_blacklist(self, ctx):
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}')
@clear_blacklist.command(

View file

@ -159,35 +159,36 @@ async def on_error(error, *args, **kwargs):
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, errext.CommandOnCooldown):
await ctx.message.add_reaction('\N{HOURGLASS}')
await asyncio.sleep(error.retry_after)
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
elif isinstance(error, err.NotFound):
print('NOT FOUND')
elif isinstance(error, err.Forbidden):
pass
elif isinstance(error, errext.MissingRequiredArgument):
await ctx.send('**Missing required argument**')
await ctx.message.add_reaction('\N{CROSS MARK}')
elif isinstance(error, errext.BadArgument):
await ctx.send(f'**Invalid argument.** {error}')
await ctx.message.add_reaction('\N{CROSS MARK}')
elif isinstance(error, errext.CheckFailure):
await ctx.send('**Insufficient permissions**')
await ctx.message.add_reaction('\N{NO ENTRY}')
elif isinstance(error, errext.CommandNotFound):
print('INVALID COMMAND : {}'.format(error), file=sys.stderr)
await ctx.message.add_reaction('\N{BLACK QUESTION MARK ORNAMENT}')
else:
print('\n! ! ! ! ! ! ! ! ! ! ! !\nC O M M A N D E R R O R : {}\n! ! ! ! ! ! ! ! ! ! ! !\n'.format(
error), file=sys.stderr)
tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
await bot.get_user(u.config['owner_id']).send('**COMMAND ERROR** \N{WARNING SIGN} `{}` from {} in {}\n```\n{}```'.format(ctx.message.content, ctx.author.mention, ctx.channel.mention if isinstance(ctx.channel, d.channel.TextChannel) else 'DMs', error))
await bot.get_channel(u.config['info_channel']).send('**COMMAND ERROR** \N{WARNING SIGN} `{}` from {} in {}\n```\n{}```'.format(ctx.message.content, ctx.author.name, ctx.channel.mention if isinstance(ctx.channel, d.channel.TextChannel) else 'DMs', error))
await exc.send_error(ctx, error)
await ctx.message.add_reaction('\N{WARNING SIGN}')
# u.notify('C O M M A N D E R R O R')
with suppress(err.NotFound):
if isinstance(error, errext.CommandOnCooldown):
await ctx.message.add_reaction('\N{HOURGLASS}')
await asyncio.sleep(error.retry_after)
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
elif isinstance(error, err.NotFound):
print('NOT FOUND')
elif isinstance(error, err.Forbidden):
pass
elif isinstance(error, errext.MissingRequiredArgument):
await ctx.send('**Missing required argument**')
await ctx.message.add_reaction('\N{CROSS MARK}')
elif isinstance(error, errext.BadArgument):
await ctx.send(f'**Invalid argument.** {error}')
await ctx.message.add_reaction('\N{CROSS MARK}')
elif isinstance(error, errext.CheckFailure):
await ctx.send('**Insufficient permissions**')
await ctx.message.add_reaction('\N{NO ENTRY}')
elif isinstance(error, errext.CommandNotFound):
print('INVALID COMMAND : {}'.format(error), file=sys.stderr)
await ctx.message.add_reaction('\N{BLACK QUESTION MARK ORNAMENT}')
else:
print('\n! ! ! ! ! ! ! ! ! ! ! !\nC O M M A N D E R R O R : {}\n! ! ! ! ! ! ! ! ! ! ! !\n'.format(
error), file=sys.stderr)
tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
await bot.get_user(u.config['owner_id']).send('**COMMAND ERROR** \N{WARNING SIGN} `{}` from {} in {}\n```\n{}```'.format(ctx.message.content, ctx.author.mention, ctx.channel.mention if isinstance(ctx.channel, d.channel.TextChannel) else 'DMs', error))
await bot.get_channel(u.config['info_channel']).send('**COMMAND ERROR** \N{WARNING SIGN} `{}` from {} in {}\n```\n{}```'.format(ctx.message.content, ctx.author.name, ctx.channel.mention if isinstance(ctx.channel, d.channel.TextChannel) else 'DMs', error))
await exc.send_error(ctx, error)
await ctx.message.add_reaction('\N{WARNING SIGN}')
# u.notify('C O M M A N D E R R O R')
# @bot.event
# async def on_command(ctx):

View file

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