From 142336e2334cd7564a13e58bc619d4833f5b0270 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 28 Feb 2024 13:32:31 -0500 Subject: [PATCH] feat(pterodactyl): handle server status changes --- pterodactyl/pterodactyl.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 5a586b7..86fe5fa 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -82,6 +82,11 @@ class Pterodactyl(commands.Cog): if content.startswith('['): await channel.send(content=content) #TODO - Add pagification for long messages to prevent Discord API errors + + if json.loads(message)['event'] == 'status': + console = self.bot.get_channel(await self.config.console_channel()) + if console is not None: + await console.send(f"Server status changed! `{json.loads(message)['args'][0]}`") except websockets.exceptions.ConnectionClosed as e: self.logger.debug("WebSocket connection closed: %s", e) websocket_credentials = client.servers.get_websocket(server_id)