mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Merge branch 'dev'
This commit is contained in:
commit
b4725ab4e7
2 changed files with 26 additions and 14 deletions
|
@ -1423,11 +1423,15 @@ class MsG:
|
||||||
async def get_global_blacklist(self, ctx, *args):
|
async def get_global_blacklist(self, ctx, *args):
|
||||||
args, lst = u.kwargs(args)
|
args, lst = u.kwargs(args)
|
||||||
default = set() if lst == 'blacklist' else {}
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
blacklist = self.blacklists['global'].get(lst, default)
|
||||||
|
|
||||||
|
if blacklist:
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['global'].get(lst, default),
|
blacklist,
|
||||||
start=f'\N{NO ENTRY SIGN} **Global {lst}:**')
|
start=f'\N{NO ENTRY SIGN} **Global {lst}:**')
|
||||||
|
else:
|
||||||
|
await ctx.send(f'\N{CROSS MARK} **No global {lst} found**')
|
||||||
|
|
||||||
@get_blacklist.command(
|
@get_blacklist.command(
|
||||||
name='channel',
|
name='channel',
|
||||||
|
@ -1437,11 +1441,15 @@ class MsG:
|
||||||
async def get_channel_blacklist(self, ctx, *args):
|
async def get_channel_blacklist(self, ctx, *args):
|
||||||
args, lst = u.kwargs(args)
|
args, lst = u.kwargs(args)
|
||||||
default = set() if lst == 'blacklist' else {}
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
blacklist = self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, default)
|
||||||
|
|
||||||
|
if blacklist:
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, default),
|
blacklist,
|
||||||
start=f'\N{NO ENTRY SIGN} {ctx.channel.mention} **{lst}:**')
|
start=f'\N{NO ENTRY SIGN} {ctx.channel.mention} **{lst}:**')
|
||||||
|
else:
|
||||||
|
await ctx.send(f'\N{CROSS MARK} **No {lst} found for {ctx.channel.mention}**')
|
||||||
|
|
||||||
@get_blacklist.command(
|
@get_blacklist.command(
|
||||||
name='me',
|
name='me',
|
||||||
|
@ -1451,11 +1459,15 @@ class MsG:
|
||||||
async def get_user_blacklist(self, ctx, *args):
|
async def get_user_blacklist(self, ctx, *args):
|
||||||
args, lst = u.kwargs(args)
|
args, lst = u.kwargs(args)
|
||||||
default = set() if lst == 'blacklist' else {}
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
blacklist = self.blacklists['user'].get(ctx.author.id, {}).get(lst, default)
|
||||||
|
|
||||||
|
if blacklist:
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['user'].get(ctx.author.id, {}).get(lst, default),
|
blacklist,
|
||||||
start=f'\N{NO ENTRY SIGN} {ctx.author.mention}**\'s {lst}:**')
|
start=f'\N{NO ENTRY SIGN} {ctx.author.mention}**\'s {lst}:**')
|
||||||
|
else:
|
||||||
|
await ctx.send(f'\N{CROSS MARK} **No {lst} found for {ctx.author.mention}**')
|
||||||
|
|
||||||
@blacklist.group(
|
@blacklist.group(
|
||||||
name='add',
|
name='add',
|
||||||
|
|
|
@ -51,9 +51,9 @@ async def paginate(
|
||||||
|
|
||||||
elif type(i) is dict:
|
elif type(i) is dict:
|
||||||
if not i:
|
if not i:
|
||||||
i = {'': ' '}
|
i = {' ': ' '}
|
||||||
for k, e in sorted(i.items()):
|
for k, e in sorted(i.items()):
|
||||||
paginator.add_line(kprefix if k else '' + k + ksuffix if k else '' + eprefix + f'{ejoin}'.join(e) + esuffix)
|
paginator.add_line(kprefix + k + ksuffix + eprefix + f'{ejoin}'.join(e) + esuffix)
|
||||||
|
|
||||||
if end:
|
if end:
|
||||||
paginator.add_line(end)
|
paginator.add_line(end)
|
||||||
|
|
Loading…
Reference in a new issue