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

Merge branch 'dev'

This commit is contained in:
Dylan Dizon 2018-11-06 16:15:47 -05:00
commit df39625897

View file

@ -663,7 +663,7 @@ class MsG:
# Creates temp blacklist based on context
for bl in (self.blacklists['global_blacklist'], self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()), self.blacklists['user_blacklist'].get(ctx.author.id, set())):
for tag in bl:
blacklist.add(tag)
blacklist.add([tag] + list(self.aliases[tag]))
# Checks for, assigns, and removes first order in tags if possible
order = [tag for tag in tags if 'order:' in tag]
if order:
@ -1495,17 +1495,19 @@ class MsG:
return True
return False
aliases = set()
aliases = {}
try:
for tag in tags:
aliases.add(tag)
blacklist.add(tag)
aliases[tag] = set()
alias_request = await u.fetch('https://e621.net/tag_alias/index.json', params={'aliased_to': tag, 'approved': 'true'}, json=True)
if alias_request:
for dic in alias_request:
aliases.add(dic['name'])
aliases[tag].add(dic['name'])
message = await ctx.send(f'**Also add aliases?**```\n{formatter.tostring(aliases)}```')
message = await ctx.send(f'**Also add aliases?**\n{formatter.dict_tostring(aliases)}')
await message.add_reaction('\N{THUMBS DOWN SIGN}')
await message.add_reaction('\N{HEAVY MINUS SIGN}')
await message.add_reaction('\N{THUMBS UP SIGN}')
@ -1514,7 +1516,7 @@ class MsG:
await self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60)
except exc.Remove:
await message.edit(content=f'**Also add aliases?**```\n{formatter.tostring(aliases)}```\nType the tag(s) to remove or `0` to abort:')
await message.edit(content=f'**Also add aliases?**\n{formatter.dict_tostring(aliases)}\nType the tag(s) to remove or `0` to abort:')
with suppress(err.Forbidden):
await message.remove_reaction('\N{HEAVY MINUS SIGN}', self.bot.user)
@ -1523,17 +1525,18 @@ class MsG:
response = await self.bot.wait_for('message', check=on_message, timeout=7 * 60)
for tag in response.content.split(' '):
if tag in aliases:
aliases.remove(tag)
for v in aliases.values():
if tag in v:
v.remove(tag)
await message.edit(content=f'**Also add aliases?**```\n{formatter.tostring(aliases)}```\nConfirm or deny changes')
await message.edit(content=f'**Also add aliases?**\n{formatter.dict_tostring(aliases)}\nConfirm or deny changes')
await self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60)
blacklist.update(aliases)
self.aliases.update(aliases)
await message.delete()
return aliases
return blacklist
except exc.Continue:
await message.delete()