From b7f5ae644a384c3423710d86b626fbccbf6b9175 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 1 Mar 2024 14:18:44 -0500 Subject: [PATCH] fix(pterodactyl): check if websocket_credentials is None --- pterodactyl/websocket.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pterodactyl/websocket.py b/pterodactyl/websocket.py index c814ada..e9a62bf 100644 --- a/pterodactyl/websocket.py +++ b/pterodactyl/websocket.py @@ -4,7 +4,6 @@ import re from logging import getLogger from typing import Optional, Union - import aiohttp import discord import websockets @@ -22,6 +21,8 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None: logger.info("Establishing WebSocket connection") websocket_credentials = await retrieve_websocket_credentials(coginstance) + if not websocket_credentials: + return logger.error("Failed to retrieve WebSocket credentials. WebSocket connection not established") async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60, logger=getLogger("red.sea.pterodactyl.websocket")) as websocket: logger.info("WebSocket connection established")