From 2bffbd90011f4c68eb05e945592ce768e7c4f4ca Mon Sep 17 00:00:00 2001 From: Predeactor <61093863+Predeactor@users.noreply.github.com> Date: Fri, 29 Jan 2021 20:03:24 +0100 Subject: [PATCH] [Core] Fix commands using plural with the same user (#4750) * [Core] Fix commands using plural with the same user Some plural checking have also been added to the local blocklist/allowlist and the wording has been revised. * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * BLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACK * the Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> --- redbot/core/core_commands.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 7dd54e6de..893003200 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -47,7 +47,6 @@ from .utils.chat_formatting import ( ) from .commands.requires import PrivilegeLevel - _entities = { "*": "*", "\\": "\", @@ -92,7 +91,6 @@ __all__ = ["Core"] log = logging.getLogger("red") - _ = i18n.Translator("Core", __file__) TokenConverter = commands.get_dict_converter(delims=[" ", ",", ";"]) @@ -2805,7 +2803,7 @@ 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) - if len(users) > 1: + if len(uids) > 1: await ctx.send(_("Users have been added to the allowlist.")) else: await ctx.send(_("User has been added to the allowlist.")) @@ -2837,7 +2835,7 @@ 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) - if len(users) > 1: + if len(uids) > 1: await ctx.send(_("Users have been removed from the allowlist.")) else: await ctx.send(_("User has been removed from the allowlist.")) @@ -2874,7 +2872,7 @@ 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) - if len(users) > 1: + if len(uids) > 1: await ctx.send(_("Users have been added to the blocklist.")) else: await ctx.send(_("User has been added to the blocklist.")) @@ -2906,7 +2904,7 @@ 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) - if len(users) > 1: + if len(uids) > 1: await ctx.send(_("Users have been removed from the blocklist.")) else: await ctx.send(_("User has been removed from the blocklist.")) @@ -2951,7 +2949,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): ) await self.bot._whiteblacklist_cache.add_to_whitelist(ctx.guild, uids) - await ctx.send(_("{names} added to allowlist.").format(names=humanize_list(names))) + if len(uids) > 1: + await ctx.send(_("Users and/or roles have been added to the allowlist.")) + else: + await ctx.send(_("User or role has been added to the allowlist.")) @localallowlist.command(name="list") async def localallowlist_list(self, ctx: commands.Context): @@ -2995,9 +2996,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): ) await self.bot._whiteblacklist_cache.remove_from_whitelist(ctx.guild, uids) - await ctx.send( - _("{names} removed from the server allowlist.").format(names=humanize_list(names)) - ) + if len(uids) > 1: + await ctx.send(_("Users and/or roles have been removed from the server allowlist.")) + else: + await ctx.send(_("User or role has been removed from the server allowlist.")) @localallowlist.command(name="clear") async def localallowlist_clear(self, ctx: commands.Context): @@ -3038,9 +3040,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): uids = {getattr(u_or_r, "id", u_or_r) for u_or_r in users_or_roles} await self.bot._whiteblacklist_cache.add_to_blacklist(ctx.guild, uids) - await ctx.send( - _("{names} added to the server blocklist.").format(names=humanize_list(names)) - ) + if len(uids) > 1: + await ctx.send(_("Users and/or roles have been added from the server blocklist.")) + else: + await ctx.send(_("User or role has been added from the server blocklist.")) @localblocklist.command(name="list") async def localblocklist_list(self, ctx: commands.Context): @@ -3073,9 +3076,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): uids = {getattr(u_or_r, "id", u_or_r) for u_or_r in users_or_roles} await self.bot._whiteblacklist_cache.remove_from_blacklist(ctx.guild, uids) - await ctx.send( - _("{names} removed from the server blocklist.").format(names=humanize_list(names)) - ) + if len(uids) > 1: + await ctx.send(_("Users and/or roles have been removed from the server blocklist.")) + else: + await ctx.send(_("User or role has been removed from the server blocklist.")) @localblocklist.command(name="clear") async def localblocklist_clear(self, ctx: commands.Context):