|
|
|
@ -21,7 +21,6 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
def __init__(self, bot):
|
|
|
|
|
self.bot = bot
|
|
|
|
|
self.color = d.Color(0x1A1A1A)
|
|
|
|
|
self.LIMIT = 100
|
|
|
|
|
self.HISTORY_LIMIT = 150
|
|
|
|
|
self.RATE_LIMIT = u.RATE_LIMIT
|
|
|
|
@ -57,13 +56,13 @@ class MsG:
|
|
|
|
|
#
|
|
|
|
|
# print('AUTO-POSTING : #{}'.format(ctx.channel.name))
|
|
|
|
|
# await ctx.send('**Auto-posting all images in {}**'.format(ctx.channel.mention), delete_after=5)
|
|
|
|
|
# await ctx.message.add_reaction('✅')
|
|
|
|
|
# await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
# else:
|
|
|
|
|
# raise exc.Exists
|
|
|
|
|
#
|
|
|
|
|
# except exc.Exists:
|
|
|
|
|
# await ctx.send('**Already auto-posting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
# await ctx.message.add_reaction('❌')
|
|
|
|
|
# await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
# Tag search
|
|
|
|
|
@commands.command(aliases=['rel'], brief='e621 Search for related tags', description='e621 | NSFW\nReturn related tags for a number of given tags', usage='[related|rel]')
|
|
|
|
@ -86,7 +85,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
related.clear()
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
# Tag aliases
|
|
|
|
|
@commands.command(name='aliases', aliases=['alias'], brief='e621 Tag aliases', description='e621 | NSFW\nSearch aliases for given tag')
|
|
|
|
@ -109,13 +108,13 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
aliases.clear()
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='pool', aliases=['getpool', 'getp', 'gp'], brief='e621 Search for pools', description='e621 | NSFW\nReturn pool for query', usage='[related|rel]')
|
|
|
|
|
@commands.command(name='getpool', aliases=['pool', 'getp', 'gp'], brief='e621 Search for pools', description='e621 | NSFW\nReturn pool for query', usage='[related|rel]')
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
|
async def get_pool(self, ctx, *args):
|
|
|
|
|
def on_reaction(reaction, user):
|
|
|
|
|
if reaction.emoji == '🛑' 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:
|
|
|
|
|
raise exc.Abort(match)
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -136,7 +135,7 @@ class MsG:
|
|
|
|
|
pools.append(pool['name'])
|
|
|
|
|
match = await ctx.send('**Multiple pools found for `{}`.** Type the number of the correct match\n```\n{}```'.format(' '.join(query), '\n'.join(['{} {}'.format(c, elem) for c, elem in enumerate(pools, 1)])))
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('🛑')
|
|
|
|
|
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
|
|
|
|
done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=60),
|
|
|
|
|
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=60), self.bot.wait_for('message', check=on_message, timeout=60)], return_when=asyncio.FIRST_COMPLETED)
|
|
|
|
|
for future in done:
|
|
|
|
@ -151,7 +150,7 @@ class MsG:
|
|
|
|
|
raise exc.NotFound
|
|
|
|
|
|
|
|
|
|
await ctx.send(f'**{tempool["name"]}**\nhttps://e621.net/pool/show/{tempool["id"]}')
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.Abort as e:
|
|
|
|
|
await e.message.edit(content='**Search aborted**', delete_after=10)
|
|
|
|
@ -175,11 +174,11 @@ class MsG:
|
|
|
|
|
finally:
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.MissingArgument:
|
|
|
|
|
await ctx.send('**Invalid url or file**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
# 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')
|
|
|
|
@ -218,13 +217,13 @@ class MsG:
|
|
|
|
|
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
|
|
|
|
|
|
|
|
|
if c:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
else:
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.MissingArgument:
|
|
|
|
|
await ctx.send('**Invalid url or file** Be sure the link directs to an image file', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='quality', aliases=['qual', 'qrev', 'qis'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
@ -266,13 +265,13 @@ class MsG:
|
|
|
|
|
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
|
|
|
|
|
|
|
|
|
if c:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
else:
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.MissingArgument:
|
|
|
|
|
await ctx.send('**Invalid url or file** Be sure the link directs to an image file', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
@ -299,7 +298,7 @@ class MsG:
|
|
|
|
|
for attachment in message.attachments:
|
|
|
|
|
links[message].append(attachment.url)
|
|
|
|
|
|
|
|
|
|
await message.add_reaction('⏳')
|
|
|
|
|
await message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
c += 1
|
|
|
|
|
|
|
|
|
|
if not links:
|
|
|
|
@ -312,7 +311,7 @@ class MsG:
|
|
|
|
|
await dest.trigger_typing()
|
|
|
|
|
|
|
|
|
|
await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(n, len(links), message.author.display_name, await scraper.get_post(url)))
|
|
|
|
|
await message.add_reaction('✅')
|
|
|
|
|
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
@ -322,23 +321,23 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
except exc.MatchError as e:
|
|
|
|
|
await ctx.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e), delete_after=10)
|
|
|
|
|
await message.add_reaction('❌')
|
|
|
|
|
await message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
c -= 1
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
n += 1
|
|
|
|
|
|
|
|
|
|
if c > 0:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
else:
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.NotFound:
|
|
|
|
|
await ctx.send('**No matches found**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.BoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **invalid limit.** Query limited to 30'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='qualitify', aliases=['qualify', 'qrevify', 'qrisify', 'qify'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
@ -365,7 +364,7 @@ class MsG:
|
|
|
|
|
for attachment in message.attachments:
|
|
|
|
|
links[message].append(attachment.url)
|
|
|
|
|
|
|
|
|
|
await message.add_reaction('⏳')
|
|
|
|
|
await message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
c += 1
|
|
|
|
|
|
|
|
|
|
if not links:
|
|
|
|
@ -380,7 +379,7 @@ class MsG:
|
|
|
|
|
post = await scraper.get_post(url)
|
|
|
|
|
|
|
|
|
|
await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(n, len(links), message.author.display_name, await scraper.get_image(post)))
|
|
|
|
|
await message.add_reaction('✅')
|
|
|
|
|
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
@ -390,23 +389,23 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
except exc.MatchError as e:
|
|
|
|
|
await ctx.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e), delete_after=10)
|
|
|
|
|
await message.add_reaction('❌')
|
|
|
|
|
await message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
c -= 1
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
n += 1
|
|
|
|
|
|
|
|
|
|
if c > 0:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
else:
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.NotFound:
|
|
|
|
|
await ctx.send('**No matches found**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.BoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **invalid limit.** Query limited to 30'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
async def _qualitify(self):
|
|
|
|
|
while self.qualitifying:
|
|
|
|
@ -429,7 +428,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
await message.channel.send('**Probable match from** {}\n{}'.format(message.author.display_name, await scraper.get_image(post)))
|
|
|
|
|
with suppress(err.NotFound):
|
|
|
|
|
await message.add_reaction('✅')
|
|
|
|
|
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
@ -438,7 +437,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
except exc.MatchError as e:
|
|
|
|
|
await message.channel.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
|
|
|
|
await message.add_reaction('❌')
|
|
|
|
|
await message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
print('STOPPED : qualitifying')
|
|
|
|
|
|
|
|
|
@ -454,7 +453,7 @@ class MsG:
|
|
|
|
|
while not self.bot.is_closed():
|
|
|
|
|
message = await self.bot.wait_for('message', check=check)
|
|
|
|
|
await self.qualiqueue.put(message)
|
|
|
|
|
await message.add_reaction('⏳')
|
|
|
|
|
await message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
|
|
|
|
|
except exc.Abort:
|
|
|
|
|
u.tasks['auto_qual'].remove(channel.id)
|
|
|
|
@ -478,13 +477,13 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
print('AUTO-QUALITIFYING : #{}'.format(ctx.channel.name))
|
|
|
|
|
await ctx.send('**Auto-qualitifying all images in** {}'.format(ctx.channel.mention), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
else:
|
|
|
|
|
raise exc.Exists
|
|
|
|
|
|
|
|
|
|
except exc.Exists:
|
|
|
|
|
await ctx.send('**Already auto-qualitifying in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
def _get_favorites(self, ctx, args):
|
|
|
|
|
if '-f' in args or '-favs' in args or '-faves' in args or '-favorites' in args:
|
|
|
|
@ -496,8 +495,10 @@ class MsG:
|
|
|
|
|
return args
|
|
|
|
|
|
|
|
|
|
def _get_score(self, score):
|
|
|
|
|
if score <= 0:
|
|
|
|
|
if score < 0:
|
|
|
|
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/mozilla/36/pile-of-poo_1f4a9.png'
|
|
|
|
|
elif score == 0:
|
|
|
|
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/pouting-face_1f621.png'
|
|
|
|
|
elif 10 > score > 0:
|
|
|
|
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/white-medium-star_2b50.png'
|
|
|
|
|
elif 50 > score >= 10:
|
|
|
|
@ -510,7 +511,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
async def _get_pool(self, ctx, *, destination, booru='e621', query=[]):
|
|
|
|
|
def on_reaction(reaction, user):
|
|
|
|
|
if reaction.emoji == '🛑' 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:
|
|
|
|
|
raise exc.Abort(match)
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -528,7 +529,7 @@ class MsG:
|
|
|
|
|
pools.append(pool['name'])
|
|
|
|
|
match = await ctx.send('**Multiple pools found for `{}`.** Type the number of the correct match.\n```\n{}```'.format(' '.join(query), '\n'.join(['{} {}'.format(c, elem) for c, elem in enumerate(pools, 1)])))
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('🛑')
|
|
|
|
|
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
|
|
|
|
done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=60),
|
|
|
|
|
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=60), self.bot.wait_for('message', check=on_message, timeout=60)], return_when=asyncio.FIRST_COMPLETED)
|
|
|
|
|
for future in done:
|
|
|
|
@ -632,19 +633,19 @@ class MsG:
|
|
|
|
|
raise exc.NotFound
|
|
|
|
|
|
|
|
|
|
# Creates reaction-based paginator for linked pools
|
|
|
|
|
@commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format', hidden=True)
|
|
|
|
|
@commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format')
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
|
async def pool_paginator(self, ctx, *args):
|
|
|
|
|
def on_reaction(reaction, user):
|
|
|
|
|
if reaction.emoji == '🛑' 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:
|
|
|
|
|
raise exc.Abort
|
|
|
|
|
elif reaction.emoji == '❤' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Save
|
|
|
|
|
elif reaction.emoji == '⬅' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Left
|
|
|
|
|
elif reaction.emoji == '#⃣' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.GoTo
|
|
|
|
|
elif reaction.emoji == '➡' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Right
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -664,7 +665,7 @@ class MsG:
|
|
|
|
|
values = list(posts.values())
|
|
|
|
|
|
|
|
|
|
embed = d.Embed(
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=dest.me.color if isinstance(dest.channel, d.TextChannel) else self.color)
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=dest.me.color if isinstance(dest.channel, d.TextChannel) else u.color)
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
embed.set_author(name=pool['name'],
|
|
|
|
|
url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=ctx.author.avatar_url)
|
|
|
|
@ -673,9 +674,9 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
paginator = await dest.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
for emoji in ('❤', '⬅', '#⃣', '➡'):
|
|
|
|
|
for emoji in ('\N{HEAVY BLACK HEART}', '\N{LEFTWARDS BLACK ARROW}', '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{BLACK RIGHTWARDS ARROW}'):
|
|
|
|
|
await paginator.add_reaction(emoji)
|
|
|
|
|
await ctx.message.add_reaction('🛑')
|
|
|
|
|
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
|
|
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
|
|
|
|
while not self.bot.is_closed():
|
|
|
|
@ -689,11 +690,11 @@ class MsG:
|
|
|
|
|
if values[c - 1]['url'] not in hearted:
|
|
|
|
|
hearted.append(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤')
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}')
|
|
|
|
|
else:
|
|
|
|
|
hearted.remove(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='💔')
|
|
|
|
|
await paginator.edit(content='\N{BROKEN HEART}')
|
|
|
|
|
|
|
|
|
|
except exc.Left:
|
|
|
|
|
if c > 1:
|
|
|
|
@ -704,7 +705,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
else:
|
|
|
|
|
await paginator.edit(content='**First image**')
|
|
|
|
|
|
|
|
|
@ -720,7 +721,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
|
|
|
|
|
except exc.Right:
|
|
|
|
|
if c < len(keys):
|
|
|
|
@ -731,7 +732,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
else:
|
|
|
|
|
await paginator.edit(content='**Last image**')
|
|
|
|
|
|
|
|
|
@ -742,7 +743,7 @@ class MsG:
|
|
|
|
|
await dest.send('**Exited paginator**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except asyncio.TimeoutError:
|
|
|
|
|
try:
|
|
|
|
|
await paginator.edit(content='**Paginator timed out**')
|
|
|
|
@ -750,41 +751,41 @@ class MsG:
|
|
|
|
|
await dest.send('**Paginator timed out**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except exc.NotFound:
|
|
|
|
|
await ctx.send('**Pool not found**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Timeout:
|
|
|
|
|
await ctx.send('**Request timed out**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Continue:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
if hearted:
|
|
|
|
|
await ctx.message.add_reaction('⏳')
|
|
|
|
|
await ctx.message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
|
|
|
|
|
for url in hearted:
|
|
|
|
|
await ctx.author.send('`{} / {}`\n{}'.format(hearted.index(url) + 1, len(hearted), url))
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='e621page', aliases=['e621p', 'e6p', '6p'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
|
@checks.is_nsfw()
|
|
|
|
|
async def e621_paginator(self, ctx, *args):
|
|
|
|
|
def on_reaction(reaction, user):
|
|
|
|
|
if reaction.emoji == '🛑' 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:
|
|
|
|
|
raise exc.Abort
|
|
|
|
|
elif reaction.emoji == '❤' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Save
|
|
|
|
|
elif reaction.emoji == '⬅' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Left
|
|
|
|
|
elif reaction.emoji == '#⃣' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.GoTo
|
|
|
|
|
elif reaction.emoji == '➡' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Right
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -807,7 +808,7 @@ class MsG:
|
|
|
|
|
values = list(posts.values())
|
|
|
|
|
|
|
|
|
|
embed = d.Embed(
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color)
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
|
|
|
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
|
|
|
@ -816,9 +817,9 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
paginator = await dest.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
for emoji in ('❤', '⬅', '#⃣', '➡'):
|
|
|
|
|
for emoji in ('\N{HEAVY BLACK HEART}', '\N{LEFTWARDS BLACK ARROW}', '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{BLACK RIGHTWARDS ARROW}'):
|
|
|
|
|
await paginator.add_reaction(emoji)
|
|
|
|
|
await ctx.message.add_reaction('🛑')
|
|
|
|
|
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
|
|
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
|
|
|
|
while not self.bot.is_closed():
|
|
|
|
@ -832,11 +833,11 @@ class MsG:
|
|
|
|
|
if values[c - 1]['url'] not in hearted:
|
|
|
|
|
hearted.append(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤')
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}')
|
|
|
|
|
else:
|
|
|
|
|
hearted.remove(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='💔')
|
|
|
|
|
await paginator.edit(content='\N{BROKEN HEART}')
|
|
|
|
|
|
|
|
|
|
except exc.Left:
|
|
|
|
|
if c > 1:
|
|
|
|
@ -847,7 +848,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
else:
|
|
|
|
|
await paginator.edit(content='**First image**')
|
|
|
|
|
|
|
|
|
@ -863,7 +864,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
|
|
|
|
|
except exc.Right:
|
|
|
|
|
try:
|
|
|
|
@ -881,7 +882,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
|
|
|
|
|
except IndexError:
|
|
|
|
|
await paginator.edit(content='**No more images found**')
|
|
|
|
@ -895,7 +896,7 @@ class MsG:
|
|
|
|
|
await dest.send('**Exited paginator**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except asyncio.TimeoutError:
|
|
|
|
|
try:
|
|
|
|
|
await paginator.edit(content='**Paginator timed out**')
|
|
|
|
@ -903,53 +904,53 @@ class MsG:
|
|
|
|
|
await dest.send('**Paginator timed out**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except exc.NotFound as e:
|
|
|
|
|
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.TagBlacklisted as e:
|
|
|
|
|
await ctx.send('🚫 `{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('🚫')
|
|
|
|
|
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
|
|
|
|
|
except exc.TagBoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.FavoritesNotFound:
|
|
|
|
|
await ctx.send('**You have no favorite tags**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Timeout:
|
|
|
|
|
await ctx.send('**Request timed out**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
if hearted:
|
|
|
|
|
await ctx.message.add_reaction('⏳')
|
|
|
|
|
await ctx.message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
|
|
|
|
|
for url in hearted:
|
|
|
|
|
await ctx.author.send('`{} / {}`\n{}'.format(hearted.index(url) + 1, len(hearted), url))
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@e621_paginator.error
|
|
|
|
|
async def e621_paginator_error(self, ctx, error):
|
|
|
|
|
if isinstance(error, errext.CheckFailure):
|
|
|
|
|
await ctx.send('⛔️ {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
return await ctx.message.add_reaction('⛔️')
|
|
|
|
|
await ctx.send('\N{NO ENTRY} {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
return await ctx.message.add_reaction('\N{NO ENTRY}')
|
|
|
|
|
|
|
|
|
|
@commands.command(name='e926page', aliases=['e926p', 'e9p', '9p'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
|
async def e926_paginator(self, ctx, *args):
|
|
|
|
|
def on_reaction(reaction, user):
|
|
|
|
|
if reaction.emoji == '🛑' 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:
|
|
|
|
|
raise exc.Abort
|
|
|
|
|
elif reaction.emoji == '❤' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Save
|
|
|
|
|
elif reaction.emoji == '⬅' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Left
|
|
|
|
|
elif reaction.emoji == '#⃣' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.GoTo
|
|
|
|
|
elif reaction.emoji == '➡' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
|
|
|
|
raise exc.Right
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -972,7 +973,7 @@ class MsG:
|
|
|
|
|
values = list(posts.values())
|
|
|
|
|
|
|
|
|
|
embed = d.Embed(
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e926.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color)
|
|
|
|
|
title=values[c - 1]['artist'], url='https://e926.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
|
|
|
|
url='https://e926.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
|
|
|
@ -981,9 +982,9 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
paginator = await dest.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
for emoji in ('❤', '⬅', '#⃣', '➡'):
|
|
|
|
|
for emoji in ('\N{HEAVY BLACK HEART}', '\N{LEFTWARDS BLACK ARROW}', '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{BLACK RIGHTWARDS ARROW}'):
|
|
|
|
|
await paginator.add_reaction(emoji)
|
|
|
|
|
await ctx.message.add_reaction('🛑')
|
|
|
|
|
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
|
|
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
|
|
|
|
while not self.bot.is_closed():
|
|
|
|
@ -997,11 +998,11 @@ class MsG:
|
|
|
|
|
if values[c - 1]['url'] not in hearted:
|
|
|
|
|
hearted.append(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤')
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}')
|
|
|
|
|
else:
|
|
|
|
|
hearted.remove(values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='💔')
|
|
|
|
|
await paginator.edit(content='\N{BROKEN HEART}')
|
|
|
|
|
|
|
|
|
|
except exc.Left:
|
|
|
|
|
if c > 1:
|
|
|
|
@ -1012,7 +1013,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
else:
|
|
|
|
|
await paginator.edit(content='**First image**')
|
|
|
|
|
|
|
|
|
@ -1028,7 +1029,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
|
|
|
|
|
except exc.Right:
|
|
|
|
|
try:
|
|
|
|
@ -1046,7 +1047,7 @@ class MsG:
|
|
|
|
|
icon_url=self._get_score(values[c - 1]['score']))
|
|
|
|
|
embed.set_image(url=values[c - 1]['url'])
|
|
|
|
|
|
|
|
|
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
|
|
|
|
|
|
|
|
|
except IndexError:
|
|
|
|
|
await paginator.edit(content='**No more images found**')
|
|
|
|
@ -1060,7 +1061,7 @@ class MsG:
|
|
|
|
|
await dest.send('**Exited paginator**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except asyncio.TimeoutError:
|
|
|
|
|
try:
|
|
|
|
|
await paginator.edit(content='**Paginator timed out**')
|
|
|
|
@ -1068,33 +1069,33 @@ class MsG:
|
|
|
|
|
await dest.send('**Paginator timed out**')
|
|
|
|
|
|
|
|
|
|
if not hearted:
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
except exc.NotFound as e:
|
|
|
|
|
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.TagBlacklisted as e:
|
|
|
|
|
await ctx.send('🚫 `{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('🚫')
|
|
|
|
|
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
|
|
|
|
|
except exc.TagBoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.FavoritesNotFound:
|
|
|
|
|
await ctx.send('**You have no favorite tags**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Timeout:
|
|
|
|
|
await ctx.send('**Request timed out**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
if hearted:
|
|
|
|
|
await ctx.message.add_reaction('⏳')
|
|
|
|
|
await ctx.message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
|
|
|
|
|
|
|
|
|
for url in hearted:
|
|
|
|
|
await ctx.author.send('`{} / {}`\n{}'.format(hearted.index(url) + 1, len(hearted), url))
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(self.RATE_LIMIT)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
# Searches for and returns images from e621.net given tags when not blacklisted
|
|
|
|
|
@commands.group(aliases=['e6', '6'], brief='e621 | NSFW', description='e621 | NSFW\nTag-based search for e621.net\n\nYou can only search 5 tags and 6 images at once for now.\ne6 [tags...] ([# of images])')
|
|
|
|
@ -1113,7 +1114,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
for ident, post in posts.items():
|
|
|
|
|
embed = d.Embed(title=post['artist'], url='https://e621.net/post/show/{}'.format(ident),
|
|
|
|
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
|
|
|
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color).set_image(url=post['url'])
|
|
|
|
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
|
|
|
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
|
|
|
|
embed.set_footer(
|
|
|
|
@ -1121,26 +1122,26 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
await dest.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagBlacklisted as e:
|
|
|
|
|
await ctx.send('`{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.BoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Images limited to 3.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.TagBoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.NotFound as e:
|
|
|
|
|
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.FavoritesNotFound:
|
|
|
|
|
await ctx.send('**You have no favorite tags**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Timeout:
|
|
|
|
|
await ctx.send('**Request timed out**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
# tools.command_dict.setdefault(str(ctx.author.id), {}).update(
|
|
|
|
|
# {'command': ctx.command, 'args': ctx.args})
|
|
|
|
@ -1148,8 +1149,8 @@ class MsG:
|
|
|
|
|
@e621.error
|
|
|
|
|
async def e621_error(self, ctx, error):
|
|
|
|
|
if isinstance(error, errext.CheckFailure):
|
|
|
|
|
await ctx.send('⛔️ {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
return await ctx.message.add_reaction('⛔️')
|
|
|
|
|
await ctx.send('\N{NO ENTRY} {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
|
|
|
|
return await ctx.message.add_reaction('\N{NO ENTRY}')
|
|
|
|
|
|
|
|
|
|
# Searches for and returns images from e926.net given tags when not blacklisted
|
|
|
|
|
@commands.command(aliases=['e9', '9'], brief='e926 | SFW', description='e926 | SFW\nTag-based search for e926.net\n\nYou can only search 5 tags and 6 images at once for now.\ne9 [tags...] ([# of images])')
|
|
|
|
@ -1167,7 +1168,7 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
for ident, post in posts.items():
|
|
|
|
|
embed = d.Embed(title=post['artist'], url='https://e926.net/post/show/{}'.format(ident),
|
|
|
|
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
|
|
|
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color).set_image(url=post['url'])
|
|
|
|
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
|
|
|
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
|
|
|
|
embed.set_footer(
|
|
|
|
@ -1175,33 +1176,33 @@ class MsG:
|
|
|
|
|
|
|
|
|
|
await dest.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagBlacklisted as e:
|
|
|
|
|
await ctx.send('`{}` **blacklisted**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.BoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Images limited to 3.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.TagBoundsError as e:
|
|
|
|
|
await ctx.send('`{}` **out of bounds.** Tags limited to 5.'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.NotFound as e:
|
|
|
|
|
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.FavoritesNotFound:
|
|
|
|
|
await ctx.send('**You have no favorite tags**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.Timeout:
|
|
|
|
|
await ctx.send('**Request timed out**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@commands.group(aliases=['fave', 'fav', 'f'])
|
|
|
|
|
@checks.del_ctx()
|
|
|
|
|
async def favorite(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@favorite.error
|
|
|
|
|
async def favorite_error(self, ctx, error):
|
|
|
|
@ -1215,8 +1216,8 @@ class MsG:
|
|
|
|
|
async def __get_favorite_tags(self, ctx, *args):
|
|
|
|
|
dest = u.get_kwargs(ctx, args)['destination']
|
|
|
|
|
|
|
|
|
|
await dest.send('⭐️ {}**\'s favorite tags:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(self.favorites.get(ctx.author.id, {}).get('tags', set()))), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{WHITE MEDIUM STAR} {}**\'s favorite tags:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(self.favorites.get(ctx.author.id, {}).get('tags', set()))), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_favorite.command(name='posts', aliases=['p'])
|
|
|
|
|
async def __get_favorite_posts(self, ctx):
|
|
|
|
@ -1242,14 +1243,14 @@ class MsG:
|
|
|
|
|
u.dump(self.favorites, 'cogs/favorites.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{} **added to their favorites:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.BoundsError:
|
|
|
|
|
await ctx.send('**Favorites list currently limited to:** `5`', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
except exc.TagBlacklisted as e:
|
|
|
|
|
await ctx.send('🚫 `{}` **blacklisted**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('🚫')
|
|
|
|
|
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
|
|
|
|
|
|
|
|
|
|
@_add_favorite.command(name='posts', aliases=['p'])
|
|
|
|
|
async def __add_favorite_posts(self, ctx, *posts):
|
|
|
|
@ -1275,11 +1276,11 @@ class MsG:
|
|
|
|
|
u.dump(self.favorites, 'cogs/favorites.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{} **removed from their favorites:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagError as e:
|
|
|
|
|
await ctx.send('`{}` **not in favorites**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_remove_favorite.command(name='posts', aliases=['p'])
|
|
|
|
|
async def __remove_favorite_posts(self, ctx):
|
|
|
|
@ -1298,7 +1299,7 @@ class MsG:
|
|
|
|
|
u.dump(self.favorites, 'cogs/favorites.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{}**\'s favorites cleared**'.format(ctx.author.mention), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_clear_favorite.command(name='posts', aliases=['p'])
|
|
|
|
|
async def __clear_favorite_posts(self, ctx):
|
|
|
|
@ -1310,7 +1311,7 @@ class MsG:
|
|
|
|
|
async def blacklist(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Use a flag to manage blacklists.**\n*Type* `{}help bl` *for more info.*'.format(ctx.prefix), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
# @blacklist.error
|
|
|
|
|
# async def blacklist_error(self, ctx, error):
|
|
|
|
@ -1321,14 +1322,14 @@ class MsG:
|
|
|
|
|
async def _get_blacklist(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Invalid blacklist**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_blacklist.command(name='global', aliases=['gl', 'g'])
|
|
|
|
|
async def __get_global_blacklist(self, ctx, *args):
|
|
|
|
|
dest = u.get_kwargs(ctx, args)['destination']
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 **Global blacklist:**\n```\n{}```'.format(formatter.tostring(self.blacklists['global_blacklist'])))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} **Global blacklist:**\n```\n{}```'.format(formatter.tostring(self.blacklists['global_blacklist'])))
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_blacklist.command(name='channel', aliases=['ch', 'c'])
|
|
|
|
|
async def __get_channel_blacklist(self, ctx, *args):
|
|
|
|
@ -1337,15 +1338,15 @@ class MsG:
|
|
|
|
|
guild = ctx.guild if isinstance(
|
|
|
|
|
ctx.guild, d.Guild) else ctx.channel
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 {} **blacklist:**\n```\n{}```'.format(ctx.channel.mention, formatter.tostring(self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()))))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} {} **blacklist:**\n```\n{}```'.format(ctx.channel.mention, formatter.tostring(self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()))))
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_blacklist.command(name='me', aliases=['m'])
|
|
|
|
|
async def __get_user_blacklist(self, ctx, *args):
|
|
|
|
|
dest = u.get_kwargs(ctx, args)['destination']
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 {}**\'s blacklist:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(self.blacklists['user_blacklist'].get(ctx.author.id, set()))), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} {}**\'s blacklist:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(self.blacklists['user_blacklist'].get(ctx.author.id, set()))), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_blacklist.command(name='here', aliases=['h'])
|
|
|
|
|
async def __get_here_blacklists(self, ctx, *args):
|
|
|
|
@ -1354,14 +1355,14 @@ class MsG:
|
|
|
|
|
guild = ctx.guild if isinstance(
|
|
|
|
|
ctx.guild, d.Guild) else ctx.channel
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 **__Blacklisted:__**\n\n**Global:**\n```\n{}```\n**{}:**\n```\n{}```'.format(formatter.tostring(self.blacklists['global_blacklist']), ctx.channel.mention, formatter.tostring(self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()))))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} **__Blacklisted:__**\n\n**Global:**\n```\n{}```\n**{}:**\n```\n{}```'.format(formatter.tostring(self.blacklists['global_blacklist']), ctx.channel.mention, formatter.tostring(self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()))))
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_get_blacklist.group(name='all', aliases=['a'])
|
|
|
|
|
async def __get_all_blacklists(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Invalid blacklist**')
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@__get_all_blacklists.command(name='guild', aliases=['g'])
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
@ -1371,22 +1372,22 @@ class MsG:
|
|
|
|
|
guild = ctx.guild if isinstance(
|
|
|
|
|
ctx.guild, d.Guild) else ctx.channel
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 **__{} blacklists:__**\n\n{}'.format(guild.name, formatter.dict_tostring(self.blacklists['guild_blacklist'].get(guild.id, {}))))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} **__{} blacklists:__**\n\n{}'.format(guild.name, formatter.dict_tostring(self.blacklists['guild_blacklist'].get(guild.id, {}))))
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@__get_all_blacklists.command(name='user', aliases=['u', 'member', 'm'])
|
|
|
|
|
@commands.is_owner()
|
|
|
|
|
async def ___get_all_user_blacklists(self, ctx, *args):
|
|
|
|
|
dest = u.get_kwargs(ctx, args)['destination']
|
|
|
|
|
|
|
|
|
|
await dest.send('🚫 **__User blacklists:__**\n\n{}'.format(formatter.dict_tostring(self.blacklists['user_blacklist'])))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await dest.send('\N{NO ENTRY SIGN} **__User blacklists:__**\n\n{}'.format(formatter.dict_tostring(self.blacklists['user_blacklist'])))
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@blacklist.group(name='add', aliases=['a'])
|
|
|
|
|
async def _add_tags(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Invalid blacklist**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_add_tags.command(name='global', aliases=['gl', 'g'])
|
|
|
|
|
@commands.is_owner()
|
|
|
|
@ -1408,7 +1409,7 @@ class MsG:
|
|
|
|
|
u.dump(self.aliases, 'cogs/aliases.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('**Added to global blacklist:**\n```\n{}```'.format(formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_add_tags.command(name='channel', aliases=['ch', 'c'])
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
@ -1434,7 +1435,7 @@ class MsG:
|
|
|
|
|
u.dump(self.aliases, 'cogs/aliases.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('**Added to** {} **blacklist:**\n```\n{}```'.format(ctx.channel.mention, formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_add_tags.command(name='me', aliases=['m'])
|
|
|
|
|
async def __add_user_tags(self, ctx, *args):
|
|
|
|
@ -1455,13 +1456,13 @@ class MsG:
|
|
|
|
|
u.dump(self.aliases, 'cogs/aliases.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{} **added to their blacklist:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@blacklist.group(name='remove', aliases=['rm', 'r'])
|
|
|
|
|
async def _remove_tags(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Invalid blacklist**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_remove_tags.command(name='global', aliases=['gl', 'g'])
|
|
|
|
|
@commands.is_owner()
|
|
|
|
@ -1480,11 +1481,11 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('**Removed from global blacklist:**\n```\n{}```'.format(formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagError as e:
|
|
|
|
|
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_remove_tags.command(name='channel', aliases=['ch', 'c'])
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
@ -1506,11 +1507,11 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('**Removed from** {} **blacklist:**\n```\n{}```'.format(ctx.channel.mention, formatter.tostring(tags), delete_after=5))
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagError as e:
|
|
|
|
|
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_remove_tags.command(name='me', aliases=['m'])
|
|
|
|
|
async def __remove_user_tags(self, ctx, *args):
|
|
|
|
@ -1528,17 +1529,17 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{} **removed from their blacklist:**\n```\n{}```'.format(ctx.author.mention, formatter.tostring(tags)), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
except exc.TagError as e:
|
|
|
|
|
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@blacklist.group(name='clear', aliases=['cl', 'c'])
|
|
|
|
|
async def _clear_blacklist(self, ctx):
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
await ctx.send('**Invalid blacklist**', delete_after=10)
|
|
|
|
|
await ctx.message.add_reaction('❌')
|
|
|
|
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
|
|
|
|
|
|
|
|
|
@_clear_blacklist.command(name='global', aliases=['gl', 'g'])
|
|
|
|
|
@commands.is_owner()
|
|
|
|
@ -1549,7 +1550,7 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('**Global blacklist cleared**', delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_clear_blacklist.command(name='channel', aliases=['ch', 'c'])
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
@ -1564,7 +1565,7 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{} **blacklist cleared**'.format(ctx.channel.mention), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|
|
|
|
|
|
@_clear_blacklist.command(name='me', aliases=['m'])
|
|
|
|
|
async def __clear_user_blacklist(self, ctx, *args):
|
|
|
|
@ -1575,4 +1576,4 @@ class MsG:
|
|
|
|
|
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
|
|
|
|
|
|
|
|
|
await dest.send('{}**\'s blacklist cleared**'.format(ctx.author.mention), delete_after=5)
|
|
|
|
|
await ctx.message.add_reaction('✅')
|
|
|
|
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
|
|
|
|