From 839ead56eb8ed551fa6e387f4478d838ba5ee6e5 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 29 Feb 2024 22:07:22 -0500 Subject: [PATCH] fix(pterodactyl): remove looping functionality from websocket.connect on line 62 as it's irrelevant now and was broken regardless --- pterodactyl/pterodactyl.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 50c4145..bd7b5c7 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -59,8 +59,7 @@ class Pterodactyl(commands.Cog): except exceptions.PterodactylApiError as e: return self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e) - async for websocket in websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60): - try: + async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60) as websocket: self.logger.info("WebSocket connection established") auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]}) @@ -107,10 +106,6 @@ class Pterodactyl(commands.Cog): 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.info("WebSocket connection closed: %s", e) - websocket_credentials = client.servers.get_websocket(server_id) - continue def remove_ansi_escape_codes(self, text: str) -> str: ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')