[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>
This commit is contained in:
Predeactor 2021-01-29 20:03:24 +01:00 committed by GitHub
parent 51c17110ad
commit 2bffbd9001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,6 @@ from .utils.chat_formatting import (
)
from .commands.requires import PrivilegeLevel
_entities = {
"*": "&midast;",
"\\": "&bsol;",
@ -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):