mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 19:28:54 -05:00
Add serverlock warning to [p]invite (#5898)
This commit is contained in:
parent
1fbd6d854b
commit
ed4f36a529
@ -62,6 +62,7 @@ from .utils.chat_formatting import (
|
||||
humanize_timedelta,
|
||||
inline,
|
||||
pagify,
|
||||
warning,
|
||||
)
|
||||
from .commands import CommandConverter, CogConverter
|
||||
from .commands.requires import PrivilegeLevel
|
||||
@ -1477,8 +1478,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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user