[3.4] Add serverlock warning to [p]invite (#5898) (#6063)

Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com>
This commit is contained in:
Red-GitHubBot
2023-04-20 00:07:27 +02:00
committed by GitHub
parent 1f285c6e7f
commit e51953bc42

View File

@@ -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(