From ccbce180dd8f8dca48ec267ffdc06355f4c9b0d7 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 28 Feb 2024 13:03:31 -0500 Subject: [PATCH] fix(pterodactyl): hopefully fixed the websocket closing on console output event --- pterodactyl/pterodactyl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 9289625..a8a6dd2 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -76,8 +76,9 @@ class Pterodactyl(commands.Cog): if json.loads(message)['event'] == 'console output' and await self.config.console_channel() is not None: channel = self.bot.get_channel(await self.config.console_channel) - await channel.send(json.loads(message)['args'][0][:1900]) - #FIXME - Add pagification for long messages to prevent Discord API errors + if channel is not None: + await channel.send(json.loads(message)['args'][0][:1900]) + #TODO - Add pagification for long messages to prevent Discord API errors except websockets.exceptions.ConnectionClosed as e: self.logger.debug("WebSocket connection closed: %s", e) websocket_credentials = client.servers.get_websocket(server_id)