diff --git a/src/cogs/booru.py b/src/cogs/booru.py index a8ec4de..e72c203 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -450,6 +450,9 @@ class MsG: 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}') + except Exception: + await ctx.send('**The image database is offline.** Please try again later') + await ctx.message.add_reaction('\N{CROSS MARK}') @cmds.command(name='reversify', aliases=['revify', 'risify', 'rify']) async def reversify(self, ctx, *args): @@ -525,6 +528,9 @@ class MsG: except exc.BoundsError as e: await ctx.send('`{}` **invalid limit.** Query limited to 30'.format(e), delete_after=7) await ctx.message.add_reaction('\N{CROSS MARK}') + except Exception: + await ctx.send('**The image database is offline.** Please try again later') + await ctx.message.add_reaction('\N{CROSS MARK}') async def _reversify(self): while self.reversifying: @@ -827,7 +833,9 @@ class MsG: icon_url=self._get_score(values[c - 1]['score'])) embed.set_image(url=values[c - 1]['file_url']) - await number.delete() + if ctx.channel is d.TextChannel: + with suppress(errext.CheckFailure): + await number.delete() await paginator.edit(content='\N{HEAVY BLACK HEART}' if keys[c - 1] in hearted.keys() else None, embed=embed) @@ -967,7 +975,9 @@ class MsG: icon_url=self._get_score(values[c - 1]['score'])) embed.set_image(url=values[c - 1]['file_url']) - await number.delete() + if ctx.channel is d.TextChannel: + with suppress(errext.CheckFailure): + await number.delete() await paginator.edit(content='\N{HEAVY BLACK HEART}' if keys[c - 1] in hearted.keys() else None, embed=embed) diff --git a/src/run.py b/src/run.py index e6964ff..34e760a 100644 --- a/src/run.py +++ b/src/run.py @@ -82,7 +82,7 @@ async def on_ready(): # bot.loop.create_task(u.clear(booru.temp_urls, 30*60)) if u.config['playing'] is not '': - await bot.change_presence(game=d.Game(name=u.config['playing'])) + await bot.change_presence(activity=d.Game(name=u.config['playing'])) print('\n> > > > > > > > >\nC O N N E C T E D : {}\n> > > > > > > > >\n'.format(bot.user.name)) await bot.get_channel(u.config['info_channel']).send(f'**Started** \N{BLACK SUN WITH RAYS} `{"` or `".join(u.config["prefix"])}`') @@ -172,8 +172,8 @@ async def on_command_error(ctx, error): 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 ctx.channel is 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.mention, ctx.channel.mention if ctx.channel is d.channel.TextChannel else 'DMs', error)) + 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.mention, 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')