mirror of
https://github.com/myned/modufur.git
synced 2024-12-26 06:57:29 +00:00
Merge branch 'dev'
This commit is contained in:
commit
67e93e618b
5 changed files with 46 additions and 33 deletions
|
@ -277,7 +277,7 @@ class MsG(cmds.Cog):
|
||||||
async def get(self, ctx):
|
async def get(self, ctx):
|
||||||
if not ctx.invoked_subcommand:
|
if not ctx.invoked_subcommand:
|
||||||
await ctx.send('**Use a flag to get items.**\n*Type* `{}help get` *for more info.*'.format(ctx.prefix))
|
await ctx.send('**Use a flag to get items.**\n*Type* `{}help get` *for more info.*'.format(ctx.prefix))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@get.command(name='info', aliases=['i'], brief='(get) Get info from post', description='Return info for given post URL or ID\n\nExample:\n\{p\}get info 1145042')
|
@get.command(name='info', aliases=['i'], brief='(get) Get info from post', description='Return info for given post URL or ID\n\nExample:\n\{p\}get info 1145042')
|
||||||
async def _get_info(self, ctx, *args):
|
async def _get_info(self, ctx, *args):
|
||||||
|
@ -304,8 +304,8 @@ class MsG(cmds.Cog):
|
||||||
icon_url=self._get_icon(post['score']))
|
icon_url=self._get_icon(post['score']))
|
||||||
|
|
||||||
except exc.MissingArgument:
|
except exc.MissingArgument:
|
||||||
await ctx.send('\N{CROSS MARK} **Invalid url**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid url**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@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')
|
||||||
async def _get_image(self, ctx, *args):
|
async def _get_image(self, ctx, *args):
|
||||||
|
@ -331,8 +331,8 @@ class MsG(cmds.Cog):
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
|
|
||||||
except exc.MissingArgument:
|
except exc.MissingArgument:
|
||||||
await ctx.send('\N{CROSS MARK} **Invalid url or file**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid url or file**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@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')
|
||||||
async def _get_pool(self, ctx, *args):
|
async def _get_pool(self, ctx, *args):
|
||||||
|
@ -422,14 +422,18 @@ class MsG(cmds.Cog):
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
|
|
||||||
except exc.MissingArgument:
|
except exc.MissingArgument:
|
||||||
await ctx.send('\N{CROSS MARK} **Invalid url or file.** Be sure the link directs to an image file')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid url or file.** Be sure the link directs to an image file')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
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')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except err.HTTPException:
|
except err.HTTPException:
|
||||||
await ctx.send('\N{CROSS MARK} **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{CROSS MARK}')
|
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)
|
||||||
|
@ -502,13 +506,17 @@ class MsG(cmds.Cog):
|
||||||
|
|
||||||
except exc.NotFound:
|
except exc.NotFound:
|
||||||
await dest.send('**No matches found**')
|
await dest.send('**No matches found**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except exc.BoundsError as e:
|
except exc.BoundsError as e:
|
||||||
await dest.send('`{}` **invalid limit.** Query limited to 30'.format(e))
|
await dest.send('`{}` **invalid limit.** Query limited to 5'.format(e))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except err.HTTPException:
|
except err.HTTPException:
|
||||||
await dest.send('\N{CROSS MARK} **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{CROSS MARK}')
|
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:
|
||||||
|
@ -548,7 +556,7 @@ class MsG(cmds.Cog):
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
await message.add_reaction('\N{CROSS MARK}')
|
||||||
except exc.SizeError as e:
|
except exc.SizeError as e:
|
||||||
await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB')
|
await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB')
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
await message.add_reaction('\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except Exception:
|
except Exception:
|
||||||
await message.channel.send(f'**An unknown error occurred.**')
|
await message.channel.send(f'**An unknown error occurred.**')
|
||||||
await message.add_reaction('\N{WARNING SIGN}')
|
await message.add_reaction('\N{WARNING SIGN}')
|
||||||
|
@ -985,7 +993,7 @@ class MsG(cmds.Cog):
|
||||||
await u.add_reaction(ctx.message, '\N{NO ENTRY SIGN}')
|
await u.add_reaction(ctx.message, '\N{NO ENTRY SIGN}')
|
||||||
except exc.TagBoundsError as e:
|
except exc.TagBoundsError as e:
|
||||||
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e))
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except exc.FavoritesNotFound:
|
except exc.FavoritesNotFound:
|
||||||
await ctx.send('**You have no favorite tags**')
|
await ctx.send('**You have no favorite tags**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
|
@ -1043,10 +1051,10 @@ class MsG(cmds.Cog):
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
except exc.BoundsError as e:
|
except exc.BoundsError as e:
|
||||||
await ctx.send('`{}` **out of bounds.** Images limited to 3.'.format(e))
|
await ctx.send('`{}` **out of bounds.** Images limited to 3.'.format(e))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except exc.TagBoundsError as e:
|
except exc.TagBoundsError as e:
|
||||||
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e))
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
except exc.NotFound as e:
|
except exc.NotFound as e:
|
||||||
await ctx.send('`{}` **not found**'.format(e))
|
await ctx.send('`{}` **not found**'.format(e))
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
|
@ -1185,9 +1193,9 @@ class MsG(cmds.Cog):
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
'**Use a flag to manage blacklists.**\n'
|
'**Use a flag to manage blacklists.**\n'
|
||||||
f'*Type* `{ctx.prefix}help bl` *for more info.*')
|
f'*Type* `{ctx.prefix}help bl` *for more info.*')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
elif not ctx.args:
|
elif not ctx.args:
|
||||||
await ctx.send('\N{CROSS MARK} **Missing arguments**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Missing arguments**')
|
||||||
|
|
||||||
@blacklist.group(
|
@blacklist.group(
|
||||||
name='get',
|
name='get',
|
||||||
|
@ -1197,8 +1205,8 @@ class MsG(cmds.Cog):
|
||||||
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('\N{CROSS MARK} **Invalid blacklist**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid blacklist**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@get_blacklist.command(
|
@get_blacklist.command(
|
||||||
name='global',
|
name='global',
|
||||||
|
@ -1366,8 +1374,8 @@ class MsG(cmds.Cog):
|
||||||
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('\N{CROSS MARK} **Invalid blacklist**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid blacklist**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
def _remove(self, remove, lst):
|
def _remove(self, remove, lst):
|
||||||
removed = set()
|
removed = set()
|
||||||
|
@ -1464,8 +1472,8 @@ class MsG(cmds.Cog):
|
||||||
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('\N{CROSS MARK} **Invalid blacklist**')
|
await ctx.send('\N{HEAVY EXCLAMATION MARK SYMBOL} **Invalid blacklist**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@clear_blacklist.command(
|
@clear_blacklist.command(
|
||||||
name='global',
|
name='global',
|
||||||
|
|
|
@ -179,7 +179,7 @@ class Bot(cmds.Cog):
|
||||||
await ctx.send(f'**Username changed to** `{username}`')
|
await ctx.send(f'**Username changed to** `{username}`')
|
||||||
else:
|
else:
|
||||||
await ctx.send('**Invalid string**')
|
await ctx.send('**Invalid string**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
|
|
||||||
class Tools(cmds.Cog):
|
class Tools(cmds.Cog):
|
||||||
|
|
|
@ -63,15 +63,17 @@ class Utils(cmds.Cog):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await tempchannel.send(message)
|
await tempchannel.send(message)
|
||||||
|
await ctx.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
await ctx.send('**Invalid channel**')
|
await ctx.send('**Invalid channel**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
await ctx.send('**Invalid guild**')
|
await ctx.send('**Invalid guild**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
|
|
||||||
@send.command(name='user', aliases=['u', 'member', 'm'])
|
@send.command(name='user', aliases=['u', 'member', 'm'])
|
||||||
async def send_user(self, ctx, user, *, message):
|
async def send_user(self, ctx, user, *, message):
|
||||||
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
||||||
|
await ctx.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||||
|
|
|
@ -128,10 +128,10 @@ async def on_command_error(ctx, error):
|
||||||
await u.add_reaction(ctx.message, '\N{WHITE HEAVY CHECK MARK}')
|
await u.add_reaction(ctx.message, '\N{WHITE HEAVY CHECK MARK}')
|
||||||
elif isinstance(error, errext.MissingRequiredArgument):
|
elif isinstance(error, errext.MissingRequiredArgument):
|
||||||
await ctx.send('**Missing required argument**')
|
await ctx.send('**Missing required argument**')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
elif isinstance(error, errext.BadArgument):
|
elif isinstance(error, errext.BadArgument):
|
||||||
await ctx.send(f'**Invalid argument.** {error}')
|
await ctx.send(f'**Invalid argument.** {error}')
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{HEAVY EXCLAMATION MARK SYMBOL}')
|
||||||
elif isinstance(error, errext.CheckFailure):
|
elif isinstance(error, errext.CheckFailure):
|
||||||
await ctx.send('**Insufficient permissions**')
|
await ctx.send('**Insufficient permissions**')
|
||||||
await u.add_reaction(ctx.message, '\N{NO ENTRY}')
|
await u.add_reaction(ctx.message, '\N{NO ENTRY}')
|
||||||
|
|
|
@ -67,7 +67,7 @@ async def query_kheina(url):
|
||||||
break
|
break
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'source': match[3],
|
'source': match[3].replace('\\', ''),
|
||||||
'artist': match[4],
|
'artist': match[4],
|
||||||
'thumbnail': f'https://f002.backblazeb2.com/file/kheinacom/{match[1]}.jpg',
|
'thumbnail': f'https://f002.backblazeb2.com/file/kheinacom/{match[1]}.jpg',
|
||||||
'similarity': str(similarity),
|
'similarity': str(similarity),
|
||||||
|
@ -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']))
|
||||||
|
|
Loading…
Reference in a new issue