1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Merge branch 'dev'

This commit is contained in:
Myned 2017-12-10 17:18:50 -05:00
commit 710ce58ad3
2 changed files with 13 additions and 13 deletions

View file

@ -142,14 +142,14 @@ class MsG:
while self.hearting: while self.hearting:
try: try:
await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60), await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=60 * 60),
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=60 * 60)])
except exc.Save as e: except exc.Save as e:
await self.heartqueue.put((e.user, send)) await self.heartqueue.put((e.user, send))
except asyncio.TimeoutError: except asyncio.TimeoutError:
await message.edit(content='\N{HOURGLASS}') await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
# @cmds.command() # @cmds.command()
# async def auto_post(self, ctx): # async def auto_post(self, ctx):
@ -171,12 +171,12 @@ class MsG:
# await ctx.send('**Already auto-posting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7) # await ctx.send('**Already auto-posting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7)
# await ctx.message.add_reaction('\N{CROSS MARK}') # await ctx.message.add_reaction('\N{CROSS MARK}')
@cmds.group(aliases=['tag', 't'], brief='e621 - Get info on tags', description='e621 | NSFW\nGroup command for obtaining info on tags', usage='[tags|tag|t]') @cmds.group(aliases=['tag', 't'], brief='(G) Get info on tags', description='Group command for obtaining info on tags\n\nUsage:\n\{p\}tag \{flag\} \{tag(s)\}')
async def tags(self, ctx): async def tags(self, ctx):
pass pass
# Tag search # Tag search
@tags.command(name='related', aliases=['relate', 'rel'], brief='e621 - Search for related tags', description='Return related tags for given tag(s)', usage='[related|relate|rel]') @tags.command(name='related', aliases=['relate', 'rel'], brief='(tags) Search for related tags', description='Return related tags for given tag(s)\n\nExample:\n\{p\}tag related wolf')
async def _tags_related(self, ctx, *args): async def _tags_related(self, ctx, *args):
kwargs = u.get_kwargs(ctx, args) kwargs = u.get_kwargs(ctx, args)
dest, tags = kwargs['destination'], kwargs['remaining'] dest, tags = kwargs['destination'], kwargs['remaining']
@ -206,7 +206,7 @@ class MsG:
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
# Tag aliases # Tag aliases
@tags.command(name='aliases', aliases=['alias', 'als'], brief='e621 - Search for tag aliases', description='Return aliases for given tag(s)', usage='[aliases|alias|als]') @tags.command(name='aliases', aliases=['alias', 'als'], brief='(tags) Search for tag aliases', description='Return aliases for given tag(s)\n\nExample:\n\{p\}tag alias wolf')
async def _tags_aliases(self, ctx, *args): async def _tags_aliases(self, ctx, *args):
kwargs = u.get_kwargs(ctx, args) kwargs = u.get_kwargs(ctx, args)
dest, tags = kwargs['destination'], kwargs['remaining'] dest, tags = kwargs['destination'], kwargs['remaining']
@ -235,13 +235,13 @@ class MsG:
if not c: if not c:
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@cmds.group(aliases=['g']) @cmds.group(aliases=['g'], brief='(G) Get e621 elements', description='Group command for obtaining various elements like post info\n\nUsage:\n\{p\}get \{flag\} \{args\}')
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), delete_after=7) await ctx.send('**Use a flag to get items.**\n*Type* `{}help get` *for more info.*'.format(ctx.prefix), delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get.command(name='info', aliases=['i'], brief='e621 - Get info from post', description='Return info for given post', usage='[info|i]') @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):
try: try:
kwargs = u.get_kwargs(ctx, args) kwargs = u.get_kwargs(ctx, args)
@ -275,7 +275,7 @@ class MsG:
await ctx.send('**Invalid url**', delete_after=7) await ctx.send('**Invalid url**', delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get.command(name='image', aliases=['img'], brief='e621 - Get image link', description='Return image for given post', usage='[image|img]') @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):
try: try:
kwargs = u.get_kwargs(ctx, args) kwargs = u.get_kwargs(ctx, args)
@ -306,7 +306,7 @@ class MsG:
await ctx.send('**Invalid url or file**', delete_after=7) await ctx.send('**Invalid url or file**', delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@get.command(name='pool', aliases=['p'], brief='e621 - Get pool link', description='Return pool info for given query', usage='[pool|p]') @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):
def on_reaction(reaction, user): def on_reaction(reaction, user):
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author: if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
@ -351,7 +351,7 @@ class MsG:
await e.message.edit(content='\N{NO ENTRY SIGN}', delete_after=7) await e.message.edit(content='\N{NO ENTRY SIGN}', delete_after=7)
# Reverse image searches a linked image using the public iqdb # Reverse image searches a linked image using the public iqdb
@cmds.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL') @cmds.command(name='reverse', aliases=['rev', 'ris'], brief='Reverse image search from e621', description='NSFW\nReverse-search an image with given URL')
async def reverse(self, ctx, *args): async def reverse(self, ctx, *args):
try: try:
kwargs = u.get_kwargs(ctx, args) kwargs = u.get_kwargs(ctx, args)

View file

@ -58,7 +58,7 @@ def get_prefix(bot, message):
return u.settings['prefixes'].get(message.guild.id, u.config['prefix']) return u.settings['prefixes'].get(message.guild.id, u.config['prefix'])
return u.config['prefix'] return u.config['prefix']
bot = cmds.Bot(command_prefix=get_prefix, self_bot=u.config['selfbot'], formatter=cmds.HelpFormatter(show_check_failure=True), description='Modumind - A booru bot with a side of management\n\nS for single command\nG for group command', help_attrs={'aliases': ['h']}, pm_help=None) bot = cmds.Bot(command_prefix=get_prefix, self_bot=u.config['selfbot'], formatter=cmds.HelpFormatter(show_check_failure=True), description='Modufur - A booru bot with a side of management and automated tasking\nMade by @Myned#3985\n\nNSFW for Not Safe For Wumpus commands\n(G) for group commands\np for prefix\n\n\{\} for mandatory argument\n[] for optional argument', help_attrs={'aliases': ['h']}, pm_help=None)
@bot.command(help='help', brief='brief', description='description', usage='usage', hidden=True) @bot.command(help='help', brief='brief', description='description', usage='usage', hidden=True)
async def test(ctx): async def test(ctx):
@ -142,7 +142,7 @@ async def on_error(error, *args, **kwargs):
@bot.event @bot.event
async def on_command_error(ctx, error): async def on_command_error(ctx, error):
if isinstance(error, err.NotFound): if isinstance(error, err.NotFound):
pass print('NOT FOUND')
elif isinstance(error, errext.CheckFailure): elif isinstance(error, errext.CheckFailure):
await ctx.send('**Insufficient permissions**', delete_after=10) await ctx.send('**Insufficient permissions**', delete_after=10)
await ctx.message.add_reaction('\N{NO ENTRY}') await ctx.message.add_reaction('\N{NO ENTRY}')