[3.4] Add plural forms to the responses of [p]leave command (#5391) (#5479)

* Improve the response of `[p]leave` command

* Update core_commands.py

* Update core_commands.py

* style?

* fix maybe

* black

* fixed typo in docstring

* aaa

* style

* Few more changes

(cherry picked from commit 2c51182e8e)

Co-authored-by: krak3n <84792368+the-krak3n@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: krak3n <84792368+the-krak3n@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Red-GitHubBot
2021-12-25 00:52:46 +01:00
committed by GitHub
parent de3ec3f26a
commit cb5eafb9e3

View File

@@ -405,7 +405,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
"""
async def red_delete_data_for_user(self, **kwargs):
""" Nothing to delete (Core Config is handled in a bot method ) """
"""Nothing to delete (Core Config is handled in a bot method)"""
return
@commands.command(hidden=True)
@@ -1602,6 +1602,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
return await ctx.send(_("You need to specify at least one server ID."))
leaving_local_guild = not guilds
number = len(guilds)
if leaving_local_guild:
guilds = (ctx.guild,)
@@ -1610,11 +1611,18 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
+ " (yes/no)"
)
else:
msg = (
_("Are you sure you want me to leave these servers?")
+ " (yes/no):\n"
+ "\n".join(f"- {guild.name} (`{guild.id}`)" for guild in guilds)
)
if number > 1:
msg = (
_("Are you sure you want me to leave these servers?")
+ " (yes/no):\n"
+ "\n".join(f"- {guild.name} (`{guild.id}`)" for guild in guilds)
)
else:
msg = (
_("Are you sure you want me to leave this server?")
+ " (yes/no):\n"
+ f"- {guilds[0].name} (`{guilds[0].id}`)"
)
for guild in guilds:
if guild.owner.id == ctx.me.id:
@@ -1637,9 +1645,12 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if leaving_local_guild is True:
await ctx.send(_("Alright. Bye :wave:"))
else:
await ctx.send(
_("Alright. Leaving {number} servers...").format(number=len(guilds))
)
if number > 1:
await ctx.send(
_("Alright. Leaving {number} servers...").format(number=number)
)
else:
await ctx.send(_("Alright. Leaving one server..."))
for guild in guilds:
log.debug("Leaving guild '%s' (%s)", guild.name, guild.id)
await guild.leave()
@@ -1647,7 +1658,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if leaving_local_guild is True:
await ctx.send(_("Alright, I'll stay then. :)"))
else:
await ctx.send(_("Alright, I'm not leaving those servers."))
if number > 1:
await ctx.send(_("Alright, I'm not leaving those servers."))
else:
await ctx.send(_("Alright, I'm not leaving that server."))
@commands.command()
@checks.is_owner()