feat(pterodactyl): handle server status changes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s

This commit is contained in:
Seaswimmer 2024-02-28 13:32:31 -05:00
parent f6f0a31763
commit 142336e233
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -82,6 +82,11 @@ class Pterodactyl(commands.Cog):
if content.startswith('['): if content.startswith('['):
await channel.send(content=content) await channel.send(content=content)
#TODO - Add pagification for long messages to prevent Discord API errors #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: except websockets.exceptions.ConnectionClosed as e:
self.logger.debug("WebSocket connection closed: %s", e) self.logger.debug("WebSocket connection closed: %s", e)
websocket_credentials = client.servers.get_websocket(server_id) websocket_credentials = client.servers.get_websocket(server_id)