mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 19:28:54 -05:00
[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:
parent
8dbabe24e0
commit
7630e24822
@ -2791,8 +2791,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
"""
|
"""
|
||||||
uids = {getattr(user, "id", user) for user in users}
|
uids = {getattr(user, "id", user) for user in users}
|
||||||
await self.bot._whiteblacklist_cache.add_to_whitelist(None, uids)
|
await self.bot._whiteblacklist_cache.add_to_whitelist(None, uids)
|
||||||
|
if len(users) > 1:
|
||||||
await ctx.send(_("Users added to allowlist."))
|
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")
|
@allowlist.command(name="list")
|
||||||
async def allowlist_list(self, ctx: commands.Context):
|
async def allowlist_list(self, ctx: commands.Context):
|
||||||
@ -2804,8 +2806,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
if not curr_list:
|
if not curr_list:
|
||||||
await ctx.send("Allowlist is empty.")
|
await ctx.send("Allowlist is empty.")
|
||||||
return
|
return
|
||||||
|
if len(curr_list) > 1:
|
||||||
msg = _("Users on allowlist:")
|
msg = _("Users on the allowlist:")
|
||||||
|
else:
|
||||||
|
msg = _("User on the allowlist:")
|
||||||
for user in curr_list:
|
for user in curr_list:
|
||||||
msg += "\n\t- {}".format(user)
|
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}
|
uids = {getattr(user, "id", user) for user in users}
|
||||||
await self.bot._whiteblacklist_cache.remove_from_whitelist(None, uids)
|
await self.bot._whiteblacklist_cache.remove_from_whitelist(None, uids)
|
||||||
|
if len(users) > 1:
|
||||||
await ctx.send(_("Users have been removed from the allowlist."))
|
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")
|
@allowlist.command(name="clear")
|
||||||
async def allowlist_clear(self, ctx: commands.Context):
|
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}
|
uids = {getattr(user, "id", user) for user in users}
|
||||||
await self.bot._whiteblacklist_cache.add_to_blacklist(None, uids)
|
await self.bot._whiteblacklist_cache.add_to_blacklist(None, uids)
|
||||||
|
if len(users) > 1:
|
||||||
await ctx.send(_("User added to blocklist."))
|
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")
|
@blocklist.command(name="list")
|
||||||
async def blocklist_list(self, ctx: commands.Context):
|
async def blocklist_list(self, ctx: commands.Context):
|
||||||
@ -2867,8 +2875,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
if not curr_list:
|
if not curr_list:
|
||||||
await ctx.send("Blocklist is empty.")
|
await ctx.send("Blocklist is empty.")
|
||||||
return
|
return
|
||||||
|
if len(curr_list) > 1:
|
||||||
msg = _("Users on blocklist:")
|
msg = _("Users on the blocklist:")
|
||||||
|
else:
|
||||||
|
msg = _("User on the blocklist:")
|
||||||
for user in curr_list:
|
for user in curr_list:
|
||||||
msg += "\n\t- {}".format(user)
|
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}
|
uids = {getattr(user, "id", user) for user in users}
|
||||||
await self.bot._whiteblacklist_cache.remove_from_blacklist(None, uids)
|
await self.bot._whiteblacklist_cache.remove_from_blacklist(None, uids)
|
||||||
|
if len(users) > 1:
|
||||||
await ctx.send(_("Users have been removed from blocklist."))
|
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")
|
@blocklist.command(name="clear")
|
||||||
async def blocklist_clear(self, ctx: commands.Context):
|
async def blocklist_clear(self, ctx: commands.Context):
|
||||||
@ -2930,15 +2942,17 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
@localallowlist.command(name="list")
|
@localallowlist.command(name="list")
|
||||||
async def localallowlist_list(self, ctx: commands.Context):
|
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)
|
curr_list = await self.bot._whiteblacklist_cache.get_whitelist(ctx.guild)
|
||||||
|
|
||||||
if not curr_list:
|
if not curr_list:
|
||||||
await ctx.send("Server allowlist is empty.")
|
await ctx.send("Server allowlist is empty.")
|
||||||
return
|
return
|
||||||
|
if len(curr_list) > 1:
|
||||||
msg = _("Whitelisted Users and roles:")
|
msg = _("Allowed users and/or roles:")
|
||||||
|
else:
|
||||||
|
msg = _("Allowed user or role:")
|
||||||
for obj in curr_list:
|
for obj in curr_list:
|
||||||
msg += "\n\t- {}".format(obj)
|
msg += "\n\t- {}".format(obj)
|
||||||
|
|
||||||
@ -3024,8 +3038,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
if not curr_list:
|
if not curr_list:
|
||||||
await ctx.send("Server blocklist is empty.")
|
await ctx.send("Server blocklist is empty.")
|
||||||
return
|
return
|
||||||
|
if len(curr_list) > 1:
|
||||||
msg = _("Blacklisted Users and Roles:")
|
msg = _("Blocked users and/or roles:")
|
||||||
|
else:
|
||||||
|
msg = _("Blocked user or role:")
|
||||||
for obj in curr_list:
|
for obj in curr_list:
|
||||||
msg += "\n\t- {}".format(obj)
|
msg += "\n\t- {}".format(obj)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user