mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Merge branch 'dev'
This commit is contained in:
commit
dd5ffe0c7e
4 changed files with 20 additions and 12 deletions
|
@ -66,18 +66,22 @@ class MsG:
|
|||
# Reverse image searches a linked image using the public iqdb
|
||||
@commands.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL')
|
||||
@checks.del_ctx()
|
||||
async def reverse_image_search(self, ctx, url):
|
||||
async def reverse_image_search(self, ctx, url=None):
|
||||
try:
|
||||
await ctx.trigger_typing()
|
||||
|
||||
if url is None and ctx.message.attachments:
|
||||
url = ctx.message.attachments[0].url
|
||||
elif url is None:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.send('✅ **Probable match:**\n{}'.format(await scraper.check_match(url)))
|
||||
|
||||
except exc.MatchError:
|
||||
await ctx.send('❌ **No probable match.** Make sure the URL directs to an image file.', delete_after=10)
|
||||
|
||||
@reverse_image_search.error
|
||||
async def reverse_image_search_error(self, ctx, error):
|
||||
if isinstance(error, errext.MissingRequiredArgument):
|
||||
return await ctx.send('❌ **Invalid url.**', delete_after=10)
|
||||
except exc.MissingArgument:
|
||||
await ctx.send('❌ **Invalid url or file.**', delete_after=10)
|
||||
|
||||
async def return_pool(self, *, ctx, booru='e621', query=[]):
|
||||
def on_message(msg):
|
||||
|
|
|
@ -28,7 +28,7 @@ class Bot:
|
|||
@checks.del_ctx()
|
||||
async def die(self, ctx):
|
||||
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down 🌙 . . .**')
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down** 🌙 . . .')
|
||||
# loop = self.bot.loop.all_tasks()
|
||||
# for task in loop:
|
||||
# task.cancel()
|
||||
|
@ -43,7 +43,7 @@ class Bot:
|
|||
async def restart(self, ctx):
|
||||
print('\n| | | | | | | | | |\nR E S T A R T I N G\n| | | | | | | | | |\n')
|
||||
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting 💤 . . .**')
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting** 💤 . . .')
|
||||
# u.notify('R E S T A R T I N G')
|
||||
# loop = self.bot.loop.all_tasks()
|
||||
# for task in loop:
|
||||
|
|
|
@ -25,6 +25,10 @@ class Exists(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class MissingArgument(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class PostError(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ async def on_ready():
|
|||
# bot.loop.create_task(u.clear(booru.temp_urls, 30*60))
|
||||
|
||||
if isinstance(bot.get_channel(u.config['startup_channel']), d.TextChannel):
|
||||
await bot.get_channel(u.config['startup_channel']).send('**Started ☀️ .**')
|
||||
await bot.get_channel(u.config['startup_channel']).send('**Started** ☀️ .')
|
||||
print('\n\\ \\ \\ \\ \\ \\ \\ \\ \\\nC O N N E C T E D : {}\n/ / / / / / / / /\n'.format(bot.user.name))
|
||||
# u.notify('C O N N E C T E D')
|
||||
|
||||
|
@ -54,15 +54,15 @@ async def on_error(error, *args, **kwargs):
|
|||
@bot.event
|
||||
async def on_command_error(ctx, error):
|
||||
if isinstance(error, errext.CheckFailure):
|
||||
await ctx.send('❌ **Insufficient permissions.**', delete_after=10)
|
||||
elif not isinstance(error, errext.CommandNotFound):
|
||||
await ctx.send('⛔️ **Insufficient permissions.**', delete_after=10)
|
||||
elif isinstance(error, errext.CommandNotFound):
|
||||
print('INVALID COMMAND : {}'.format(error), file=sys.stderr)
|
||||
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 exc.send_error(ctx, error)
|
||||
# u.notify('C O M M A N D E R R O R')
|
||||
else:
|
||||
print('INVALID COMMAND : {}'.format(error), file=sys.stderr)
|
||||
|
||||
|
||||
async def on_reaction_add(r, u):
|
||||
|
|
Loading…
Reference in a new issue