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
c791d0f59b
6 changed files with 257 additions and 231 deletions
|
@ -57,13 +57,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
# await ctx.message.add_reaction('✅')
|
||||
# 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('\N{CROSS MARK}')
|
||||
# await ctx.message.add_reaction('❌')
|
||||
|
||||
# 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 +86,7 @@ class MsG:
|
|||
|
||||
related.clear()
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
# Tag aliases
|
||||
@commands.command(name='aliases', aliases=['alias'], brief='e621 Tag aliases', description='e621 | NSFW\nSearch aliases for given tag')
|
||||
|
@ -109,19 +109,19 @@ class MsG:
|
|||
|
||||
aliases.clear()
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.command(name='pool', aliases=['getpool', '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_message(msg):
|
||||
if (msg.content.isdigit() and int(msg.content) == 0) or msg.content.lower() == 'cancel' and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
raise exc.Abort
|
||||
elif msg.content.isdigit():
|
||||
if int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
return True
|
||||
def on_reaction(reaction, user):
|
||||
if reaction.emoji == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||
raise exc.Abort(match)
|
||||
return False
|
||||
|
||||
def on_message(msg):
|
||||
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel
|
||||
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
dest, query = kwargs['destination'], kwargs['remaining']
|
||||
|
@ -134,8 +134,14 @@ class MsG:
|
|||
if len(pool_request) > 1:
|
||||
for pool in pool_request:
|
||||
pools.append(pool['name'])
|
||||
match = await ctx.send('**Multiple pools found for `{}`.** Type the number of the correct match.\n```\n{}```\n`0` or `cancel`'.format(' '.join(query), '\n'.join(['{} {}'.format(c, elem) for c, elem in enumerate(pools, 1)])))
|
||||
selection = await self.bot.wait_for('message', check=on_message, timeout=60)
|
||||
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('🛑')
|
||||
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:
|
||||
selection = future.result()
|
||||
|
||||
await match.delete()
|
||||
tempool = [pool for pool in pool_request if pool['name'] == pools[int(selection.content) - 1]][0]
|
||||
await selection.delete()
|
||||
|
@ -145,11 +151,10 @@ class MsG:
|
|||
raise exc.NotFound
|
||||
|
||||
await ctx.send(f'**{tempool["name"]}**\nhttps://e621.net/pool/show/{tempool["id"]}')
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.Abort:
|
||||
await ctx.send('**Search aborted**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
except exc.Abort as e:
|
||||
await e.message.edit(content='**Search aborted**', delete_after=10)
|
||||
|
||||
@commands.command(name='getimage', aliases=['geti', 'gi'])
|
||||
@checks.del_ctx()
|
||||
|
@ -170,11 +175,11 @@ class MsG:
|
|||
finally:
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.MissingArgument:
|
||||
await ctx.send('**Invalid url or file**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
# 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')
|
||||
|
@ -213,13 +218,13 @@ class MsG:
|
|||
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
||||
|
||||
if c:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
else:
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except exc.MissingArgument:
|
||||
await ctx.send('**Invalid url or file**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@commands.command(name='quality', aliases=['qual', 'qrev', 'qis'])
|
||||
@checks.del_ctx()
|
||||
|
@ -261,13 +266,13 @@ class MsG:
|
|||
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
||||
|
||||
if c:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
else:
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except exc.MissingArgument:
|
||||
await ctx.send('**Invalid url or file**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
||||
@checks.del_ctx()
|
||||
|
@ -293,7 +298,7 @@ class MsG:
|
|||
for attachment in message.attachments:
|
||||
urls.append(attachment.url)
|
||||
|
||||
await message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
||||
await message.add_reaction('⏳')
|
||||
c += 1
|
||||
|
||||
if not urls:
|
||||
|
@ -304,7 +309,7 @@ class MsG:
|
|||
await dest.trigger_typing()
|
||||
|
||||
await dest.send('**Probable match from** {} `{} / {}`\n{}'.format(message.author.display_name, urls.index(url) + 1, len(urls), await scraper.get_post(url)))
|
||||
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await message.add_reaction('✅')
|
||||
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
|
||||
|
@ -314,20 +319,20 @@ class MsG:
|
|||
|
||||
except exc.MatchError as e:
|
||||
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
||||
await message.add_reaction('\N{CROSS MARK}')
|
||||
await message.add_reaction('❌')
|
||||
c -= 1
|
||||
|
||||
if c > 0:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
else:
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except exc.NotFound:
|
||||
await ctx.send('**No matches found**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.BoundsError as e:
|
||||
await ctx.send('`{}` **invalid limit.** Query limited to 30'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@commands.command(name='qualitify', aliases=['qualify', 'qrevify', 'qrisify', 'qify'])
|
||||
@checks.del_ctx()
|
||||
|
@ -353,7 +358,7 @@ class MsG:
|
|||
for attachment in message.attachments:
|
||||
urls.append(attachment.url)
|
||||
|
||||
await message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
||||
await message.add_reaction('⏳')
|
||||
c += 1
|
||||
|
||||
if not urls:
|
||||
|
@ -366,7 +371,7 @@ class MsG:
|
|||
post = await scraper.get_post(url)
|
||||
|
||||
await dest.send('**Probable match from** {} `{} / {}`\n{}'.format(message.author.display_name, urls.index(url) + 1, len(urls), await scraper.get_image(post)))
|
||||
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await message.add_reaction('✅')
|
||||
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
|
||||
|
@ -376,20 +381,20 @@ class MsG:
|
|||
|
||||
except exc.MatchError as e:
|
||||
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10)
|
||||
await message.add_reaction('\N{CROSS MARK}')
|
||||
await message.add_reaction('❌')
|
||||
c -= 1
|
||||
|
||||
if c > 0:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
else:
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except exc.NotFound:
|
||||
await ctx.send('**No matches found**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.BoundsError as e:
|
||||
await ctx.send('`{}` **invalid limit.** Query limited to 30'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
async def _qualitify(self):
|
||||
while self.qualitifying:
|
||||
|
@ -412,7 +417,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await message.add_reaction('✅')
|
||||
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
|
||||
|
@ -421,7 +426,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('\N{CROSS MARK}')
|
||||
await message.add_reaction('❌')
|
||||
|
||||
print('STOPPED : qualitifying')
|
||||
|
||||
|
@ -437,7 +442,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('\N{HOURGLASS WITH FLOWING SAND}')
|
||||
await message.add_reaction('⏳')
|
||||
|
||||
except exc.Abort:
|
||||
u.tasks['auto_qual'].remove(channel.id)
|
||||
|
@ -461,13 +466,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
def _get_favorites(self, ctx, args):
|
||||
if '-f' in args or '-favs' in args or '-faves' in args or '-favorites' in args:
|
||||
|
@ -479,45 +484,56 @@ class MsG:
|
|||
return args
|
||||
|
||||
async def _get_pool(self, ctx, *, destination, booru='e621', query=[]):
|
||||
def on_message(msg):
|
||||
if (msg.content.isdigit() and int(msg.content) == 0) or msg.content.lower() == 'cancel' and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
raise exc.Abort
|
||||
elif msg.content.isdigit():
|
||||
if int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
return True
|
||||
def on_reaction(reaction, user):
|
||||
if reaction.emoji == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||
raise exc.Abort(match)
|
||||
return False
|
||||
|
||||
def on_message(msg):
|
||||
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel
|
||||
|
||||
posts = {}
|
||||
pool = {}
|
||||
|
||||
pools = []
|
||||
pool_request = await u.fetch('https://{}.net/pool/index.json'.format(booru), params={'query': ' '.join(query)}, json=True)
|
||||
if len(pool_request) > 1:
|
||||
for pool in pool_request:
|
||||
pools.append(pool['name'])
|
||||
match = await ctx.send('**Multiple pools found for `{}`.** Type the number of the correct match.\n```\n{}```\n`0` or `cancel`'.format(' '.join(query), '\n'.join(['{} {}'.format(c, elem) for c, elem in enumerate(pools, 1)])))
|
||||
selection = await self.bot.wait_for('message', check=on_message, timeout=60)
|
||||
await match.delete()
|
||||
tempool = [pool for pool in pool_request if pool['name']
|
||||
== pools[int(selection.content) - 1]][0]
|
||||
await selection.delete()
|
||||
pool = {'name': tempool['name'], 'id': tempool['id']}
|
||||
try:
|
||||
pools = []
|
||||
pool_request = await u.fetch('https://{}.net/pool/index.json'.format(booru), params={'query': ' '.join(query)}, json=True)
|
||||
if len(pool_request) > 1:
|
||||
for pool in pool_request:
|
||||
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 destination.trigger_typing()
|
||||
elif pool_request:
|
||||
tempool = pool_request[0]
|
||||
pool = {'name': pool_request[0]['name'], 'id': pool_request[0]['id']}
|
||||
else:
|
||||
raise exc.NotFound
|
||||
await ctx.message.add_reaction('🛑')
|
||||
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:
|
||||
selection = future.result()
|
||||
|
||||
page = 1
|
||||
while len(posts) < tempool['post_count']:
|
||||
posts_request = await u.fetch('https://{}.net/pool/show.json'.format(booru), params={'id': tempool['id'], 'page': page}, json=True)
|
||||
for post in posts_request['posts']:
|
||||
posts[post['id']] = {'artist': ', '.join(post['artist']), 'url': post['file_url']}
|
||||
page += 1
|
||||
await match.delete()
|
||||
tempool = [pool for pool in pool_request if pool['name']
|
||||
== pools[int(selection.content) - 1]][0]
|
||||
await selection.delete()
|
||||
pool = {'name': tempool['name'], 'id': tempool['id']}
|
||||
|
||||
return pool, posts
|
||||
await destination.trigger_typing()
|
||||
elif pool_request:
|
||||
tempool = pool_request[0]
|
||||
pool = {'name': pool_request[0]['name'], 'id': pool_request[0]['id']}
|
||||
else:
|
||||
raise exc.NotFound
|
||||
|
||||
page = 1
|
||||
while len(posts) < tempool['post_count']:
|
||||
posts_request = await u.fetch('https://{}.net/pool/show.json'.format(booru), params={'id': tempool['id'], 'page': page}, json=True)
|
||||
for post in posts_request['posts']:
|
||||
posts[post['id']] = {'artist': ', '.join(post['artist']), 'url': post['file_url']}
|
||||
page += 1
|
||||
|
||||
return pool, posts
|
||||
|
||||
except exc.Abort as e:
|
||||
await e.message.edit(content='**Search aborted**')
|
||||
raise exc.Continue
|
||||
|
||||
# Messy code that checks image limit and tags in blacklists
|
||||
async def _get_posts(self, ctx, *, booru='e621', tags=[], limit=1, previous={}):
|
||||
|
@ -587,23 +603,20 @@ class MsG:
|
|||
@checks.del_ctx()
|
||||
async def pool_paginator(self, ctx, *args):
|
||||
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 == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||
raise exc.Abort
|
||||
elif reaction.emoji == '\N{GROWING HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '❤' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Save
|
||||
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '⬅' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Left
|
||||
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '#⃣' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.GoTo
|
||||
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '➡' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Right
|
||||
return False
|
||||
|
||||
def on_message(msg):
|
||||
if msg.content.isdigit():
|
||||
if 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
return True
|
||||
return False
|
||||
return msg.content.isdigit() and 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel
|
||||
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
|
@ -627,9 +640,9 @@ class MsG:
|
|||
|
||||
paginator = await dest.send(embed=embed)
|
||||
|
||||
for emoji in ('\N{GROWING HEART}', '\N{LEFTWARDS BLACK ARROW}', '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{BLACK RIGHTWARDS ARROW}'):
|
||||
for emoji in ('❤', '⬅', '#⃣', '➡'):
|
||||
await paginator.add_reaction(emoji)
|
||||
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
||||
await ctx.message.add_reaction('🛑')
|
||||
await asyncio.sleep(1)
|
||||
|
||||
while not self.bot.is_closed():
|
||||
|
@ -643,11 +656,11 @@ class MsG:
|
|||
if values[c - 1]['url'] not in hearted:
|
||||
hearted.append(values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}')
|
||||
await paginator.edit(content='❤')
|
||||
else:
|
||||
hearted.remove(values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{BROKEN HEART}')
|
||||
await paginator.edit(content='💔')
|
||||
|
||||
except exc.Left:
|
||||
if c > 1:
|
||||
|
@ -658,7 +671,7 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
else:
|
||||
await paginator.edit(content='**First image**')
|
||||
|
||||
|
@ -674,7 +687,7 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
|
||||
except exc.Right:
|
||||
if c < len(keys):
|
||||
|
@ -685,66 +698,65 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
else:
|
||||
await paginator.edit(content='**Last image**')
|
||||
|
||||
except exc.Abort:
|
||||
try:
|
||||
await paginator.edit(content='**Exited paginator**')
|
||||
|
||||
except UnboundLocalError:
|
||||
await dest.send('**Exited paginator**')
|
||||
|
||||
if not hearted:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
except asyncio.TimeoutError:
|
||||
try:
|
||||
await paginator.edit(content='**Paginator timed out**')
|
||||
|
||||
except UnboundLocalError:
|
||||
await dest.send('**Paginator timed out**')
|
||||
|
||||
if not hearted:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
except exc.NotFound:
|
||||
await ctx.send('**Pool not found**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.Timeout:
|
||||
await ctx.send('**Request timed out**')
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.Continue:
|
||||
pass
|
||||
|
||||
finally:
|
||||
if hearted:
|
||||
await ctx.message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
||||
await ctx.message.add_reaction('⏳')
|
||||
|
||||
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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@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 == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||
if reaction.emoji == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||
raise exc.Abort
|
||||
elif reaction.emoji == '\N{GROWING HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '❤' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Save
|
||||
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '⬅' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Left
|
||||
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '#⃣' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.GoTo
|
||||
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
elif reaction.emoji == '➡' and reaction.message.id == paginator.id and user is ctx.author:
|
||||
raise exc.Right
|
||||
return False
|
||||
|
||||
def on_message(msg):
|
||||
if msg.content.isdigit():
|
||||
if 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
return True
|
||||
return False
|
||||
return msg.content.isdigit() and 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel
|
||||
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
|
@ -771,9 +783,9 @@ class MsG:
|
|||
|
||||
paginator = await dest.send(embed=embed)
|
||||
|
||||
for emoji in ('\N{GROWING HEART}', '\N{LEFTWARDS BLACK ARROW}', '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{BLACK RIGHTWARDS ARROW}'):
|
||||
for emoji in ('❤', '⬅', '#⃣', '➡'):
|
||||
await paginator.add_reaction(emoji)
|
||||
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
|
||||
await ctx.message.add_reaction('🛑')
|
||||
await asyncio.sleep(1)
|
||||
|
||||
while not self.bot.is_closed():
|
||||
|
@ -787,11 +799,11 @@ class MsG:
|
|||
if values[c - 1]['url'] not in hearted:
|
||||
hearted.append(values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}')
|
||||
await paginator.edit(content='❤')
|
||||
else:
|
||||
hearted.remove(values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{BROKEN HEART}')
|
||||
await paginator.edit(content='💔')
|
||||
|
||||
except exc.Left:
|
||||
if c > 1:
|
||||
|
@ -802,7 +814,7 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
else:
|
||||
await paginator.edit(content='**First image**')
|
||||
|
||||
|
@ -818,7 +830,7 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
|
||||
except exc.Right:
|
||||
try:
|
||||
|
@ -836,7 +848,7 @@ class MsG:
|
|||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||
|
||||
except IndexError:
|
||||
await paginator.edit(content='**No more images found**')
|
||||
|
@ -846,51 +858,51 @@ class MsG:
|
|||
except exc.Abort:
|
||||
try:
|
||||
await paginator.edit(content='**Exited paginator**')
|
||||
|
||||
except UnboundLocalError:
|
||||
await dest.send('**Exited paginator**')
|
||||
|
||||
if not hearted:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
except asyncio.TimeoutError:
|
||||
try:
|
||||
await paginator.edit(content='**Paginator timed out**')
|
||||
|
||||
except UnboundLocalError:
|
||||
await dest.send('**Paginator timed out**')
|
||||
|
||||
if not hearted:
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
except exc.NotFound as e:
|
||||
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.TagBlacklisted as e:
|
||||
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
|
||||
await ctx.send('🚫 `{}` **blacklisted**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('🚫')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.FavoritesNotFound:
|
||||
await ctx.send('**You have no favorite tags**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.Timeout:
|
||||
await ctx.send('**Request timed out**')
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
finally:
|
||||
if hearted:
|
||||
await ctx.message.add_reaction('\N{HOURGLASS WITH FLOWING SAND}')
|
||||
await ctx.message.add_reaction('⏳')
|
||||
|
||||
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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@e621_paginator.error
|
||||
async def e621_paginator_error(self, ctx, error):
|
||||
if isinstance(error, errext.CheckFailure):
|
||||
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}')
|
||||
await ctx.send('⛔️ {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
||||
return await ctx.message.add_reaction('⛔️')
|
||||
|
||||
# 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])')
|
||||
|
@ -917,26 +929,26 @@ class MsG:
|
|||
|
||||
await dest.send(embed=embed)
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagBlacklisted as e:
|
||||
await ctx.send('`{}` **blacklisted**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.NotFound as e:
|
||||
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.FavoritesNotFound:
|
||||
await ctx.send('**You have no favorite tags**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.Timeout:
|
||||
await ctx.send('**Request timed out**')
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
# tools.command_dict.setdefault(str(ctx.author.id), {}).update(
|
||||
# {'command': ctx.command, 'args': ctx.args})
|
||||
|
@ -944,8 +956,8 @@ class MsG:
|
|||
@e621.error
|
||||
async def e621_error(self, ctx, error):
|
||||
if isinstance(error, errext.CheckFailure):
|
||||
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}')
|
||||
await ctx.send('⛔️ {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=10)
|
||||
return await ctx.message.add_reaction('⛔️')
|
||||
|
||||
# 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])')
|
||||
|
@ -971,33 +983,33 @@ class MsG:
|
|||
|
||||
await dest.send(embed=embed)
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagBlacklisted as e:
|
||||
await ctx.send('`{}` **blacklisted**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.NotFound as e:
|
||||
await ctx.send('`{}` **not found**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.FavoritesNotFound:
|
||||
await ctx.send('**You have no favorite tags**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.Timeout:
|
||||
await ctx.send('**Request timed out**')
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@favorite.error
|
||||
async def favorite_error(self, ctx, error):
|
||||
|
@ -1011,8 +1023,8 @@ class MsG:
|
|||
async def __get_favorite_tags(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)['destination']
|
||||
|
||||
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}')
|
||||
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('✅')
|
||||
|
||||
@_get_favorite.command(name='posts', aliases=['p'])
|
||||
async def __get_favorite_posts(self, ctx):
|
||||
|
@ -1038,14 +1050,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.BoundsError:
|
||||
await ctx.send('**Favorites list currently limited to:** `5`', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
except exc.TagBlacklisted as e:
|
||||
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
|
||||
await ctx.send('🚫 `{}` **blacklisted**', delete_after=10)
|
||||
await ctx.message.add_reaction('🚫')
|
||||
|
||||
@_add_favorite.command(name='posts', aliases=['p'])
|
||||
async def __add_favorite_posts(self, ctx, *posts):
|
||||
|
@ -1071,11 +1083,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagError as e:
|
||||
await ctx.send('`{}` **not in favorites**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_remove_favorite.command(name='posts', aliases=['p'])
|
||||
async def __remove_favorite_posts(self, ctx):
|
||||
|
@ -1094,7 +1106,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_clear_favorite.command(name='posts', aliases=['p'])
|
||||
async def __clear_favorite_posts(self, ctx):
|
||||
|
@ -1106,7 +1118,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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
# @blacklist.error
|
||||
# async def blacklist_error(self, ctx, error):
|
||||
|
@ -1117,14 +1129,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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_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('\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}')
|
||||
await dest.send('🚫 **Global blacklist:**\n```\n{}```'.format(formatter.tostring(self.blacklists['global_blacklist'])))
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_get_blacklist.command(name='channel', aliases=['ch', 'c'])
|
||||
async def __get_channel_blacklist(self, ctx, *args):
|
||||
|
@ -1133,15 +1145,15 @@ class MsG:
|
|||
guild = ctx.guild if isinstance(
|
||||
ctx.guild, d.Guild) else ctx.channel
|
||||
|
||||
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}')
|
||||
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('✅')
|
||||
|
||||
@_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('\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}')
|
||||
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('✅')
|
||||
|
||||
@_get_blacklist.command(name='here', aliases=['h'])
|
||||
async def __get_here_blacklists(self, ctx, *args):
|
||||
|
@ -1150,14 +1162,14 @@ class MsG:
|
|||
guild = ctx.guild if isinstance(
|
||||
ctx.guild, d.Guild) else ctx.channel
|
||||
|
||||
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}')
|
||||
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('✅')
|
||||
|
||||
@_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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@__get_all_blacklists.command(name='guild', aliases=['g'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
|
@ -1167,22 +1179,22 @@ class MsG:
|
|||
guild = ctx.guild if isinstance(
|
||||
ctx.guild, d.Guild) else ctx.channel
|
||||
|
||||
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}')
|
||||
await dest.send('🚫 **__{} blacklists:__**\n\n{}'.format(guild.name, formatter.dict_tostring(self.blacklists['guild_blacklist'].get(guild.id, {}))))
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@__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('\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}')
|
||||
await dest.send('🚫 **__User blacklists:__**\n\n{}'.format(formatter.dict_tostring(self.blacklists['user_blacklist'])))
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_add_tags.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
|
@ -1204,7 +1216,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_add_tags.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
|
@ -1230,7 +1242,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_add_tags.command(name='me', aliases=['m'])
|
||||
async def __add_user_tags(self, ctx, *args):
|
||||
|
@ -1251,13 +1263,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_remove_tags.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
|
@ -1276,11 +1288,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagError as e:
|
||||
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_remove_tags.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
|
@ -1302,11 +1314,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagError as e:
|
||||
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_remove_tags.command(name='me', aliases=['m'])
|
||||
async def __remove_user_tags(self, ctx, *args):
|
||||
|
@ -1324,17 +1336,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.TagError as e:
|
||||
await ctx.send('`{}` **not in blacklist**'.format(e), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@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('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@_clear_blacklist.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
|
@ -1345,7 +1357,7 @@ class MsG:
|
|||
u.dump(self.blacklists, 'cogs/blacklists.pkl')
|
||||
|
||||
await dest.send('**Global blacklist cleared**', delete_after=5)
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_clear_blacklist.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
|
@ -1360,7 +1372,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@_clear_blacklist.command(name='me', aliases=['m'])
|
||||
async def __clear_user_blacklist(self, ctx, *args):
|
||||
|
@ -1371,4 +1383,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('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
|
|
@ -50,63 +50,63 @@ class Administration:
|
|||
|
||||
history = []
|
||||
try:
|
||||
pru_sent = await ctx.send('\N{HOURGLASS} **Pruning** <@{}>**\'s messages will take some time**'.format(user))
|
||||
ch_sent = await ctx.send('\N{FILE CABINET} **Caching channels...**')
|
||||
pru_sent = await ctx.send('⌛️ **Pruning** <@{}>**\'s messages will take some time**'.format(user))
|
||||
ch_sent = await ctx.send('🗄 **Caching channels...**')
|
||||
|
||||
if when is None:
|
||||
for channel in channels:
|
||||
async for message in channel.history(limit=None):
|
||||
if message.author.id == int(user):
|
||||
history.append(message)
|
||||
await ch_sent.edit(content='\N{FILE CABINET} **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
elif when == 'before':
|
||||
for channel in channels:
|
||||
async for message in channel.history(limit=None, before=ref.created_at):
|
||||
if message.author.id == int(user):
|
||||
history.append(message)
|
||||
await ch_sent.edit(content='\N{FILE CABINET} **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
elif when == 'after':
|
||||
for channel in channels:
|
||||
async for message in channel.history(limit=None, after=ref.created_at):
|
||||
if message.author.id == int(user):
|
||||
history.append(message)
|
||||
await ch_sent.edit(content='\N{FILE CABINET} **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
elif when == 'about':
|
||||
for channel in channels:
|
||||
async for message in channel.history(limit=None, about=ref.created_at):
|
||||
if message.author.id == int(user):
|
||||
history.append(message)
|
||||
await ch_sent.edit(content='\N{FILE CABINET} **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels**'.format(channels.index(channel) + 1, len(channels)))
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
|
||||
est_sent = await ctx.send('\N{STOPWATCH} **Estimated time to delete history:** `{}m {}s`'.format(int(self.RATE_LIMIT * len(history) / 60), int(self.RATE_LIMIT * len(history) % 60)))
|
||||
est_sent = await ctx.send('⏱ **Estimated time to delete history:** `{}m {}s`'.format(int(self.RATE_LIMIT * len(history) / 60), int(self.RATE_LIMIT * len(history) % 60)))
|
||||
cont_sent = await ctx.send('{} **Continue?** `Y` or `N`'.format(ctx.author.mention))
|
||||
await self.bot.wait_for('message', check=yes, timeout=10 * 60)
|
||||
await cont_sent.delete()
|
||||
del_sent = await ctx.send('\N{WASTEBASKET} **Deleting messages..**')
|
||||
del_sent = await ctx.send('🗑 **Deleting messages..**')
|
||||
await del_sent.pin()
|
||||
c = 0
|
||||
for message in history:
|
||||
with suppress(err.NotFound):
|
||||
await message.delete()
|
||||
c += 1
|
||||
await del_sent.edit(content='\N{WASTEBASKET} **Deleted** `{}/{}` **messages**'.format(history.index(message) + 1, len(history)))
|
||||
await del_sent.edit(content='🗑 **Deleted** `{}/{}` **messages**'.format(history.index(message) + 1, len(history)))
|
||||
await asyncio.sleep(self.RATE_LIMIT)
|
||||
await del_sent.unpin()
|
||||
|
||||
await ctx.send('\N{WASTEBASKET} `{}` **of** <@{}>**\'s messages left in** {}****'.format(len(history) - c, user, ctx.guild.name))
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.send('🗑 `{}` **of** <@{}>**\'s messages left in** {}****'.format(len(history) - c, user, ctx.guild.name))
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except exc.CheckFail:
|
||||
await ctx.send('**Deletion aborted**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except TimeoutError:
|
||||
await ctx.send('**Deletion timed out**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
async def delete(self):
|
||||
while self.deleting:
|
||||
|
@ -159,13 +159,13 @@ class Administration:
|
|||
self.deleting = True
|
||||
print('AUTO-DELETING : #{}'.format(ctx.channel.id))
|
||||
await ctx.send('**Auto-deleting all messages in {}**'.format(ctx.channel.mention), delete_after=5)
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
else:
|
||||
raise exc.Exists
|
||||
|
||||
except exc.Exists:
|
||||
await ctx.send('**Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=10)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@commands.command(name='deletecommands', aliases=['delcmds'])
|
||||
@commands.has_permissions(administrator=True)
|
||||
|
@ -177,7 +177,7 @@ class Administration:
|
|||
u.dump(u.settings, 'settings.pkl')
|
||||
|
||||
await ctx.send('**Delete command invocations:** `{}`'.format(ctx.guild.id in u.settings['del_ctx']))
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.command(name='setprefix', aliases=['setpre', 'spre'])
|
||||
@commands.has_permissions(administrator=True)
|
||||
|
@ -189,4 +189,4 @@ class Administration:
|
|||
del u.settings['prefixes'][ctx.guild.id]
|
||||
|
||||
await ctx.send(f'**Prefix set to:** `{"` or `".join(prefix if ctx.guild.id in u.settings["prefixes"] else u.config["prefix"])}`')
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
|
|
@ -26,9 +26,9 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def die(self, ctx):
|
||||
await ctx.message.add_reaction('\N{NEW MOON SYMBOL}')
|
||||
await ctx.message.add_reaction('🌙')
|
||||
|
||||
await self.bot.get_channel(u.config['info_channel']).send('**Shutting down** \N{NEW MOON SYMBOL} . . .')
|
||||
await self.bot.get_channel(u.config['info_channel']).send('**Shutting down** 🌙 . . .')
|
||||
# loop = self.bot.loop.all_tasks()
|
||||
# for task in loop:
|
||||
# task.cancel()
|
||||
|
@ -41,10 +41,10 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def restart(self, ctx):
|
||||
await ctx.message.add_reaction('\N{SLEEPING SYMBOL}')
|
||||
await ctx.message.add_reaction('💤')
|
||||
|
||||
print('\n| | | | | | | | | |\nR E S T A R T I N G\n| | | | | | | | | |\n')
|
||||
await self.bot.get_channel(u.config['info_channel']).send('**Restarting** \N{SLEEPING SYMBOL} . . .')
|
||||
await self.bot.get_channel(u.config['info_channel']).send('**Restarting** 💤 . . .')
|
||||
# u.notify('R E S T A R T I N G')
|
||||
|
||||
u.temp['restart_ch'] = ctx.channel.id
|
||||
|
@ -63,7 +63,7 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def invite(self, ctx):
|
||||
await ctx.message.add_reaction('\N{ENVELOPE}')
|
||||
await ctx.message.add_reaction('✉️')
|
||||
|
||||
await ctx.send('https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}'.format(u.config['client_id'], u.config['permissions']), delete_after=10)
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Bot:
|
|||
u.config['playing'] = 'None'
|
||||
u.dump(u.config, 'config.json', json=True)
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
|
||||
class Tools:
|
||||
|
@ -127,7 +127,7 @@ class Tools:
|
|||
return False
|
||||
|
||||
def exit(reaction, user):
|
||||
if reaction.emoji == '\N{LEFTWARDS ARROW WITH HOOK}' and user is ctx.author and reaction.message.id == ctx.message.id:
|
||||
if reaction.emoji == '↩️' and user is ctx.author and reaction.message.id == ctx.message.id:
|
||||
results.cancel()
|
||||
raise exc.Abort
|
||||
return False
|
||||
|
@ -136,7 +136,7 @@ class Tools:
|
|||
console = await self.generate(ctx)
|
||||
exception = await self.generate_err(ctx)
|
||||
|
||||
await ctx.message.add_reaction('\N{LEFTWARDS ARROW WITH HOOK}')
|
||||
await ctx.message.add_reaction('↩️')
|
||||
|
||||
while not self.bot.is_closed():
|
||||
try:
|
||||
|
@ -182,7 +182,7 @@ class Tools:
|
|||
sys.stderr = sys.__stderr__
|
||||
print('Reset sys output.')
|
||||
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.command(name='arbitrary', aliases=[',arbit', ',ar'])
|
||||
@commands.is_owner()
|
||||
|
@ -197,7 +197,7 @@ class Tools:
|
|||
finally:
|
||||
sys.stdout = sys.__stdout__
|
||||
print('Reset stdout.')
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.group(aliases=[',db'], hidden=True)
|
||||
@commands.is_owner()
|
||||
|
|
|
@ -6,7 +6,7 @@ import tempfile
|
|||
import traceback as tb
|
||||
import webbrowser
|
||||
|
||||
import discord
|
||||
import discord as d
|
||||
import httplib2
|
||||
import requests_oauthlib as ro
|
||||
from apiclient import http
|
||||
|
@ -48,16 +48,16 @@ class Utils:
|
|||
async def ping(self, ctx):
|
||||
global command_dict
|
||||
|
||||
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
||||
await ctx.message.add_reaction('🏓')
|
||||
|
||||
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||
await ctx.send(ctx.author.mention + ' 🏓 `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||
command_dict.setdefault(str(ctx.author.id), {}).update({'command': ctx.command})
|
||||
|
||||
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||
@checks.del_ctx()
|
||||
async def prefix(self, ctx):
|
||||
await ctx.send('**Prefix:** `{}`'.format('` or `'.join(u.settings['prefixes'][ctx.guild.id] if ctx.guild.id in u.settings['prefixes'] else u.config['prefix'])))
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.group(name=',send', aliases=[',s'], hidden=True)
|
||||
@commands.is_owner()
|
||||
|
@ -67,13 +67,26 @@ class Utils:
|
|||
|
||||
@send.command(name='guild', aliases=['g', 'server', 's'])
|
||||
async def send_guild(self, ctx, guild, channel, *, message):
|
||||
await discord.utils.get(self.bot.get_all_channels(), guild_name=guild, name=channel).send(message)
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
try:
|
||||
tempchannel = d.utils.find(lambda m: m.name == channel, d.utils.find(
|
||||
lambda m: m.name == guild, self.bot.guilds).channels)
|
||||
|
||||
try:
|
||||
await tempchannel.send(message)
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
except AttributeError:
|
||||
await ctx.send('**Invalid channel**', delete_after=10)
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
except AttributeError:
|
||||
await ctx.send('**Invalid guild**', delete_after=10)
|
||||
await ctx.message.add_reaction('❌')
|
||||
|
||||
@send.command(name='user', aliases=['u', 'member', 'm'])
|
||||
async def send_user(self, ctx, user, *, message):
|
||||
await discord.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@commands.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'])
|
||||
async def authenticate_upload(self, ctx):
|
||||
|
|
|
@ -106,7 +106,8 @@ class CheckFail(Exception):
|
|||
|
||||
|
||||
class Abort(Exception):
|
||||
pass
|
||||
def __init__(self, message=None):
|
||||
self.message = message
|
||||
|
||||
|
||||
class Continue(Exception):
|
||||
|
|
|
@ -48,12 +48,12 @@ async def on_ready():
|
|||
await bot.change_presence(game=None)
|
||||
|
||||
print('\n\\ \\ \\ \\ \\ \\ \\ \\ \\\nC O N N E C T E D : {}\n/ / / / / / / / /\n'.format(bot.user.name))
|
||||
await bot.get_channel(u.config['info_channel']).send('**Started** \N{BLACK SUN WITH RAYS} .')
|
||||
await bot.get_channel(u.config['info_channel']).send('**Started** ☀️ .')
|
||||
# u.notify('C O N N E C T E D')
|
||||
if u.temp:
|
||||
channel = bot.get_channel(u.temp['restart_ch'])
|
||||
message = await channel.get_message(u.temp['restart_msg'])
|
||||
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||
await message.add_reaction('✅')
|
||||
u.temp.clear()
|
||||
|
||||
|
||||
|
@ -67,12 +67,12 @@ async def on_message(message):
|
|||
async def on_error(error, *args, **kwargs):
|
||||
print('\n! ! ! ! !\nE R R O R : {}\n! ! ! ! !\n'.format(error), file=sys.stderr)
|
||||
tb.print_exc()
|
||||
await bot.get_user(u.config['owner_id']).send('**ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error))
|
||||
await bot.get_channel(u.config['info_channel']).send('**ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error))
|
||||
await bot.get_user(u.config['owner_id']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
||||
await bot.get_channel(u.config['info_channel']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
||||
if u.temp:
|
||||
channel = bot.get_channel(u.temp['restart_ch'])
|
||||
message = await channel.get_message(u.temp['restart_msg'])
|
||||
await message.add_reaction('\N{WARNING SIGN}')
|
||||
await message.add_reaction('⚠')
|
||||
u.temp.clear()
|
||||
# u.notify('E R R O R')
|
||||
await bot.logout()
|
||||
|
@ -82,19 +82,19 @@ async def on_error(error, *args, **kwargs):
|
|||
@bot.event
|
||||
async def on_command_error(ctx, error):
|
||||
if isinstance(error, errext.CheckFailure):
|
||||
await ctx.send('\N{NO ENTRY} **Insufficient permissions**', delete_after=10)
|
||||
await ctx.message.add_reaction('\N{NO ENTRY}')
|
||||
await ctx.send('⛔️ **Insufficient permissions**', delete_after=10)
|
||||
await ctx.message.add_reaction('⛔️')
|
||||
elif isinstance(error, errext.CommandNotFound):
|
||||
print('INVALID COMMAND : {}'.format(error), file=sys.stderr)
|
||||
await ctx.message.add_reaction('\N{BLACK QUESTION MARK ORNAMENT}')
|
||||
await ctx.message.add_reaction('❓')
|
||||
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 bot.get_user(u.config['owner_id']).send('**COMMAND ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error))
|
||||
await bot.get_channel(u.config['info_channel']).send('**COMMAND ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error))
|
||||
await bot.get_user(u.config['owner_id']).send('**COMMAND ERROR** ⚠\n```\n{}```'.format(error))
|
||||
await bot.get_channel(u.config['info_channel']).send('**COMMAND ERROR** ⚠\n```\n{}```'.format(error))
|
||||
await exc.send_error(ctx, error)
|
||||
await ctx.message.add_reaction('\N{WARNING SIGN}')
|
||||
await ctx.message.add_reaction('⚠')
|
||||
# u.notify('C O M M A N D E R R O R')
|
||||
|
||||
# d.opus.load_opus('opus')
|
||||
|
|
Loading…
Reference in a new issue