diff --git a/src/cogs/booru.py b/src/cogs/booru.py index 2bf9be9..aa46724 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -430,6 +430,10 @@ class MsG(cmds.Cog): except err.HTTPException: await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **The image database returned an unexpected result.** It may be offline') await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}') + except exc.ImageError: + await ctx.send( + '\N{HEAVY EXCLAMATION MARK SYMBOL} **None of the search engines could use this file.** ' + 'Try opening it in a browser and uploading the copied file into Discord') @cmds.command(name='reversify', aliases=['revify', 'risify', 'rify']) @cmds.cooldown(1, 5, cmds.BucketType.member) @@ -509,6 +513,10 @@ class MsG(cmds.Cog): except err.HTTPException: await dest.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **The image database returned an unexpected result.** It may be offline') await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}') + except exc.ImageError: + await ctx.send( + '\N{HEAVY EXCLAMATION MARK SYMBOL} **None of the search engines could use this file.** ' + 'Try opening it in a browser and uploading the copied file into Discord') async def _reversify(self): while self.reversifying: diff --git a/src/utils/scraper.py b/src/utils/scraper.py index d7817db..86a5cf5 100644 --- a/src/utils/scraper.py +++ b/src/utils/scraper.py @@ -83,6 +83,9 @@ async def query_saucenao(url): params={'url': url, 'api_key': u.config['saucenao_api'], 'output_type': 2}, json=True) + if content['header'].get('message', '') == 'Access to specified file was denied... ;_;': + raise exc.ImageError + match = content['results'][0] similarity = int(float(match['header']['similarity']))