From 53adeb4b80293c074c45dbf1ff84ae86b21c8f57 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 28 Feb 2024 08:11:23 -0500 Subject: [PATCH] feat(pterodactyl): added configuration commands --- pterodactyl/pterodactyl.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 8492f84..6d757ce 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -68,3 +68,34 @@ class Pterodactyl(commands.Cog): async def cog_unload(self): await self.client._session.close() + + @commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"]) + async def pterodactyl(self, ctx: commands.Context): + """Pterodactyl allows you to manage your Pterodactyl Panel from Discord.""" + pass + + @pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"]) + async def pterodactyl_config(self, ctx: commands.Context): + """Configure Pterodactyl settings.""" + pass + + @pterodactyl_config.command(name = "url") + async def pterodactyl_config_base_url(self, ctx: commands.Context, base_url: str): + """Set the base URL of your Pterodactyl Panel. Please include the protocol (http/https).""" + await self.config.base_url.set(base_url) + await ctx.send(f"Base URL set to {base_url}") + await self.establish_websocket_connection() + + @pterodactyl_config.command(name = "apikey") + async def pterodactyl_config_api_key(self, ctx: commands.Context, api_key: str): + """Set the API key for your Pterodactyl Panel.""" + await self.config.api_key.set(api_key) + await ctx.send(f"API key set to `{api_key[:5]}...{api_key[-4:]}`") + await self.establish_websocket_connection() + + @pterodactyl_config.command(name = "serverid") + async def pterodactyl_config_server_id(self, ctx: commands.Context, server_id: str): + """Set the server ID for your Pterodactyl Panel.""" + await self.config.server_id.set(server_id) + await ctx.send(f"Server ID set to {server_id}") + await self.establish_websocket_connection()