diff --git a/pterodactyl/config.py b/pterodactyl/config.py index 7af450b..2461c4c 100644 --- a/pterodactyl/config.py +++ b/pterodactyl/config.py @@ -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!', ) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index a415908..e60eb30 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -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}")