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:
commit
44bba98c41
1 changed files with 12 additions and 8 deletions
|
@ -1409,13 +1409,20 @@ class MsG:
|
||||||
guild = ctx.guild if isinstance(
|
guild = ctx.guild if isinstance(
|
||||||
ctx.guild, d.Guild) else ctx.channel
|
ctx.guild, d.Guild) else ctx.channel
|
||||||
|
|
||||||
blacklist = set()
|
aliases = {}
|
||||||
# Creates temp blacklist based on context
|
# Creates temp aliases 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 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:
|
for tag in bl:
|
||||||
blacklist.update([tag] + list(self.aliases[tag]))
|
aliases[tag] = list(self.aliases[tag])
|
||||||
|
|
||||||
await ctx.send(f'**Contextual blacklist aliases:**\n```\n{formatter.tostring(blacklist)}```')
|
paginator = cmds.Paginator(prefix='', suffix='')
|
||||||
|
|
||||||
|
for tag, alias_list in aliases.items():
|
||||||
|
paginator.add_line(f'{tag}\n```{" ".join(alias_list)}```')
|
||||||
|
|
||||||
|
for page in paginator.pages:
|
||||||
|
print(page)
|
||||||
|
await ctx.send(f'\N{NO ENTRY SIGN} **Contextual blacklist aliases:**\n{page}')
|
||||||
|
|
||||||
@_get_blacklist.command(name='global', aliases=['gl', 'g'], brief='Get current global blacklist', description='Get current global blacklist\n\nThis applies to all booru commands, in accordance with Discord\'s ToS agreement\n\nExample:\n\{p\}bl get global')
|
@_get_blacklist.command(name='global', aliases=['gl', 'g'], brief='Get current global blacklist', description='Get current global blacklist\n\nThis applies to all booru commands, in accordance with Discord\'s ToS agreement\n\nExample:\n\{p\}bl get global')
|
||||||
async def __get_global_blacklist(self, ctx, *args):
|
async def __get_global_blacklist(self, ctx, *args):
|
||||||
|
@ -1521,10 +1528,6 @@ class MsG:
|
||||||
except exc.Remove:
|
except exc.Remove:
|
||||||
await message.edit(content=f'**Also add aliases?**\n{formatter.dict_tostring(aliases, f=False)}\nType the tag(s) to remove or `0` to abort:')
|
await message.edit(content=f'**Also add aliases?**\n{formatter.dict_tostring(aliases, f=False)}\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)
|
|
||||||
await message.remove_reaction('\N{HEAVY MINUS SIGN}', ctx.author)
|
|
||||||
|
|
||||||
response = await self.bot.wait_for('message', check=on_message, timeout=7 * 60)
|
response = await self.bot.wait_for('message', check=on_message, timeout=7 * 60)
|
||||||
|
|
||||||
for tag in response.content.split(' '):
|
for tag in response.content.split(' '):
|
||||||
|
@ -1536,6 +1539,7 @@ class MsG:
|
||||||
await self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60)
|
await self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60)
|
||||||
|
|
||||||
self.aliases.update(aliases)
|
self.aliases.update(aliases)
|
||||||
|
u.dump(self.aliases, 'cogs/aliases.pkl')
|
||||||
|
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue