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

Add user error for some images not being accessible by servers

This commit is contained in:
Myned 2019-10-19 13:09:34 -04:00
parent 5662d2afdd
commit c9fbcbb639
No known key found for this signature in database
GPG key ID: BC58C09870A63E59
2 changed files with 11 additions and 0 deletions

View file

@ -430,6 +430,10 @@ class MsG(cmds.Cog):
except err.HTTPException: except err.HTTPException:
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **The image database returned an unexpected result.** It may be offline') 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}') 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.command(name='reversify', aliases=['revify', 'risify', 'rify'])
@cmds.cooldown(1, 5, cmds.BucketType.member) @cmds.cooldown(1, 5, cmds.BucketType.member)
@ -509,6 +513,10 @@ class MsG(cmds.Cog):
except err.HTTPException: except err.HTTPException:
await dest.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **The image database returned an unexpected result.** It may be offline') 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}') 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): async def _reversify(self):
while self.reversifying: while self.reversifying:

View file

@ -83,6 +83,9 @@ async def query_saucenao(url):
params={'url': url, 'api_key': u.config['saucenao_api'], 'output_type': 2}, params={'url': url, 'api_key': u.config['saucenao_api'], 'output_type': 2},
json=True) json=True)
if content['header'].get('message', '') == 'Access to specified file was denied... ;_;':
raise exc.ImageError
match = content['results'][0] match = content['results'][0]
similarity = int(float(match['header']['similarity'])) similarity = int(float(match['header']['similarity']))