[Core] Add plural forms in allowlist and blocklist commands (#4705)

* Plurial for blocklist/allowlist

* duh

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Predeactor 2021-01-22 03:56:07 +01:00 committed by GitHub
parent 8dbabe24e0
commit 7630e24822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2791,8 +2791,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
"""
uids = {getattr(user, "id", user) for user in users}
await self.bot._whiteblacklist_cache.add_to_whitelist(None, uids)
await ctx.send(_("Users added to allowlist."))
if len(users) > 1:
await ctx.send(_("Users has been added to the allowlist."))
else:
await ctx.send(_("User has been added to the allowlist."))
@allowlist.command(name="list")
async def allowlist_list(self, ctx: commands.Context):
@ -2804,8 +2806,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if not curr_list:
await ctx.send("Allowlist is empty.")
return
msg = _("Users on allowlist:")
if len(curr_list) > 1:
msg = _("Users on the allowlist:")
else:
msg = _("User on the allowlist:")
for user in curr_list:
msg += "\n\t- {}".format(user)
@ -2819,8 +2823,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
"""
uids = {getattr(user, "id", user) for user in users}
await self.bot._whiteblacklist_cache.remove_from_whitelist(None, uids)
await ctx.send(_("Users have been removed from the allowlist."))
if len(users) > 1:
await ctx.send(_("Users have been removed from the allowlist."))
else:
await ctx.send(_("User has been removed from the allowlist."))
@allowlist.command(name="clear")
async def allowlist_clear(self, ctx: commands.Context):
@ -2854,8 +2860,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
uids = {getattr(user, "id", user) for user in users}
await self.bot._whiteblacklist_cache.add_to_blacklist(None, uids)
await ctx.send(_("User added to blocklist."))
if len(users) > 1:
await ctx.send(_("Users have been added to the blocklist."))
else:
await ctx.send(_("User has been added to the blocklist."))
@blocklist.command(name="list")
async def blocklist_list(self, ctx: commands.Context):
@ -2867,8 +2875,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if not curr_list:
await ctx.send("Blocklist is empty.")
return
msg = _("Users on blocklist:")
if len(curr_list) > 1:
msg = _("Users on the blocklist:")
else:
msg = _("User on the blocklist:")
for user in curr_list:
msg += "\n\t- {}".format(user)
@ -2882,8 +2892,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
"""
uids = {getattr(user, "id", user) for user in users}
await self.bot._whiteblacklist_cache.remove_from_blacklist(None, uids)
await ctx.send(_("Users have been removed from blocklist."))
if len(users) > 1:
await ctx.send(_("Users have been removed from the blocklist."))
else:
await ctx.send(_("User has been removed from the blocklist."))
@blocklist.command(name="clear")
async def blocklist_clear(self, ctx: commands.Context):
@ -2930,15 +2942,17 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@localallowlist.command(name="list")
async def localallowlist_list(self, ctx: commands.Context):
"""
Lists users and roles on the server allowlist.
Lists users and roles on the server allowlist.
"""
curr_list = await self.bot._whiteblacklist_cache.get_whitelist(ctx.guild)
if not curr_list:
await ctx.send("Server allowlist is empty.")
return
msg = _("Whitelisted Users and roles:")
if len(curr_list) > 1:
msg = _("Allowed users and/or roles:")
else:
msg = _("Allowed user or role:")
for obj in curr_list:
msg += "\n\t- {}".format(obj)
@ -3024,8 +3038,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if not curr_list:
await ctx.send("Server blocklist is empty.")
return
msg = _("Blacklisted Users and Roles:")
if len(curr_list) > 1:
msg = _("Blocked users and/or roles:")
else:
msg = _("Blocked user or role:")
for obj in curr_list:
msg += "\n\t- {}".format(obj)