feat(pterodactyl): added startup and shutdown messages
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s

This commit is contained in:
Seaswimmer 2024-03-01 00:05:06 -05:00
parent d39f0ba104
commit 7a39c9a75d
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
2 changed files with 25 additions and 1 deletions

View file

@ -15,5 +15,7 @@ def register_config(config_obj: Config) -> None:
server_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: \[Not Secure\] \[.*\] (.*)",
chat_command='tellraw @a ["",{"text":".$U ","color":".$C"},{"text":" (DISCORD): ","color":"blue"},{"text":".$M","color":"white"}]',
api_endpoint="minecraft",
chat_channel=None
chat_channel=None,
startup_msg='Server started!',
shutdown_msg='Server stopped!',
)

View file

@ -166,3 +166,25 @@ class Pterodactyl(commands.Cog):
return await ctx.send(f"Server regex is currently set to:\n{box(regex, 'regex')}")
await config.server_regex.set(regex)
await ctx.send(f"Server regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config.group(name = "messages", aliases = ['msg', 'msgs', 'message'])
async def pterodactyl_config_messages(self, ctx: commands.Context):
"""Configure message settings."""
@pterodactyl_config_messages.command(name = "startup")
async def pterodactyl_config_messages_startup(self, ctx: commands.Context, *, message: str = None) -> None:
"""Set the message that will be sent when the server starts."""
if message is None:
message = await config.startup_msg()
return await ctx.send(f"Startup message is currently set to: {message}")
await config.startup_msg.set(message)
await ctx.send(f"Startup message set to: {message}")
@pterodactyl_config_messages.command(name = "shutdown")
async def pterodactyl_config_messages_shutdown(self, ctx: commands.Context, *, message: str = None) -> None:
"""Set the message that will be sent when the server stops."""
if message is None:
message = await config.shutdown_msg()
return await ctx.send(f"Shutdown message is currently set to: {message}")
await config.shutdown_msg.set(message)
await ctx.send(f"Shutdown message set to: {message}")