From e51953bc422d3917b62724d39eee5e4dfd941ad0 Mon Sep 17 00:00:00 2001 From: Red-GitHubBot <88117545+Red-GitHubBot@users.noreply.github.com> Date: Thu, 20 Apr 2023 00:07:27 +0200 Subject: [PATCH] [3.4] Add serverlock warning to `[p]invite` (#5898) (#6063) Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com> --- redbot/core/core_commands.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 7293599ff..ee8c9fffd 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -48,6 +48,7 @@ from .utils.chat_formatting import ( humanize_timedelta, inline, pagify, + warning, ) from .commands import CommandConverter, CogConverter from .commands.requires import PrivilegeLevel @@ -1459,8 +1460,16 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): **Example:** - `[p]invite` """ + message = await self.bot.get_invite_url() + if (admin := self.bot.get_cog("Admin")) and await admin.config.serverlocked(): + message += "\n\n" + warning( + _( + "This bot is currently **serverlocked**, meaning that it is locked " + "to its current servers and will leave any server it joins." + ) + ) try: - await ctx.author.send(await self.bot.get_invite_url()) + await ctx.author.send(message) await ctx.tick() except discord.errors.Forbidden: await ctx.send(