mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Fix potential reference issues
This commit is contained in:
parent
a37e7ccaf7
commit
1ef17cd588
1 changed files with 21 additions and 12 deletions
|
@ -1422,11 +1422,12 @@ class MsG:
|
||||||
'In accordance with Discord\'s ToS: cub, related tags, and their aliases are blacklisted')
|
'In accordance with Discord\'s ToS: cub, related tags, and their aliases are blacklisted')
|
||||||
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 {}
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['global'].get(lst, set()),
|
self.blacklists['global'].get(lst, default),
|
||||||
start=f'\N{NO ENTRY SIGN} **Global {lst}:**\n')
|
start=f'\N{NO ENTRY SIGN} **Global {lst}:**')
|
||||||
|
|
||||||
@get_blacklist.command(
|
@get_blacklist.command(
|
||||||
name='channel',
|
name='channel',
|
||||||
|
@ -1435,11 +1436,12 @@ class MsG:
|
||||||
description='Get channel blacklist')
|
description='Get channel blacklist')
|
||||||
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 {}
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, set()),
|
self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, default),
|
||||||
start=f'\N{NO ENTRY SIGN} {ctx.channel.mention} **{lst}:**\n')
|
start=f'\N{NO ENTRY SIGN} {ctx.channel.mention} **{lst}:**')
|
||||||
|
|
||||||
@get_blacklist.command(
|
@get_blacklist.command(
|
||||||
name='me',
|
name='me',
|
||||||
|
@ -1448,11 +1450,12 @@ class MsG:
|
||||||
description='Get your personal blacklist')
|
description='Get your personal blacklist')
|
||||||
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 {}
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
self.blacklists['user'].get(ctx.author.id, {}).get(lst, set()),
|
self.blacklists['user'].get(ctx.author.id, {}).get(lst, default),
|
||||||
start=f'\N{NO ENTRY SIGN} {ctx.author.mention}**\'s {lst}:**\n')
|
start=f'\N{NO ENTRY SIGN} {ctx.author.mention}**\'s {lst}:**')
|
||||||
|
|
||||||
@blacklist.group(
|
@blacklist.group(
|
||||||
name='add',
|
name='add',
|
||||||
|
@ -1501,11 +1504,12 @@ class MsG:
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
async def add_global_tags(self, ctx, *args):
|
async def add_global_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
added = await self._add(
|
added = await self._add(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['global'].setdefault(lst, set() if lst == 'blacklist' else {}),
|
self.blacklists['global'].setdefault(lst, default),
|
||||||
alias=True if lst == 'aliases' else False)
|
alias=True if lst == 'aliases' else False)
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
|
@ -1522,11 +1526,12 @@ class MsG:
|
||||||
@cmds.has_permissions(manage_channels=True)
|
@cmds.has_permissions(manage_channels=True)
|
||||||
async def add_channel_tags(self, ctx, *args):
|
async def add_channel_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
added = await self._add(
|
added = await self._add(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['channel'].setdefault(ctx.channel.id, {}).setdefault(lst, set() if lst == 'blacklist' else {}),
|
self.blacklists['channel'].setdefault(ctx.channel.id, {}).setdefault(lst, default),
|
||||||
alias=True if lst == 'aliases' else False)
|
alias=True if lst == 'aliases' else False)
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
|
@ -1542,11 +1547,12 @@ class MsG:
|
||||||
usage='[tags...]')
|
usage='[tags...]')
|
||||||
async def add_user_tags(self, ctx, *args):
|
async def add_user_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
added = await self._add(
|
added = await self._add(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['user'].setdefault(ctx.author.id, {}).setdefault(lst, set() if lst == 'blacklist' else {}),
|
self.blacklists['user'].setdefault(ctx.author.id, {}).setdefault(lst, default),
|
||||||
alias=True if lst == 'aliases' else False)
|
alias=True if lst == 'aliases' else False)
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
|
@ -1600,11 +1606,12 @@ class MsG:
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
async def remove_global_tags(self, ctx, *args):
|
async def remove_global_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
removed, skipped = self._remove(
|
removed, skipped = self._remove(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['global'].get(lst, set()))
|
self.blacklists['global'].get(lst, default))
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
|
@ -1625,11 +1632,12 @@ class MsG:
|
||||||
@cmds.has_permissions(manage_channels=True)
|
@cmds.has_permissions(manage_channels=True)
|
||||||
async def remove_channel_tags(self, ctx, *args):
|
async def remove_channel_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
removed, skipped = self._remove(
|
removed, skipped = self._remove(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, set()))
|
self.blacklists['channel'].get(ctx.channel.id, {}).get(lst, default))
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
|
@ -1649,11 +1657,12 @@ class MsG:
|
||||||
usage='[tags...]')
|
usage='[tags...]')
|
||||||
async def remove_user_tags(self, ctx, *args):
|
async def remove_user_tags(self, ctx, *args):
|
||||||
tags, lst = u.kwargs(args)
|
tags, lst = u.kwargs(args)
|
||||||
|
default = set() if lst == 'blacklist' else {}
|
||||||
|
|
||||||
async with ctx.channel.typing():
|
async with ctx.channel.typing():
|
||||||
removed, skipped = self._remove(
|
removed, skipped = self._remove(
|
||||||
tags,
|
tags,
|
||||||
self.blacklists['user'].get(ctx.author.id, {}).get(lst, set()))
|
self.blacklists['user'].get(ctx.author.id, {}).get(lst, default))
|
||||||
|
|
||||||
await formatter.paginate(
|
await formatter.paginate(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
Loading…
Reference in a new issue