mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 11:48:55 -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,
|
humanize_timedelta,
|
||||||
inline,
|
inline,
|
||||||
pagify,
|
pagify,
|
||||||
|
warning,
|
||||||
)
|
)
|
||||||
from .commands import CommandConverter, CogConverter
|
from .commands import CommandConverter, CogConverter
|
||||||
from .commands.requires import PrivilegeLevel
|
from .commands.requires import PrivilegeLevel
|
||||||
@ -1477,8 +1478,16 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
**Example:**
|
**Example:**
|
||||||
- `[p]invite`
|
- `[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:
|
try:
|
||||||
await ctx.author.send(await self.bot.get_invite_url())
|
await ctx.author.send(message)
|
||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
except discord.errors.Forbidden:
|
except discord.errors.Forbidden:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user