From 2017cbb226ae3c898e6742b911dc7a86b4e72b7f Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 28 Feb 2024 13:00:11 -0500 Subject: [PATCH] cleanup(pterodactyl): making some changes to establish_websocket_connection --- pterodactyl/pterodactyl.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 918ca90..9289625 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -36,8 +36,15 @@ class Pterodactyl(commands.Cog): try: client = PterodactylClient(base_url, api_key, debug=True).client + self.client = client websocket_credentials = client.servers.get_websocket(server_id) - self.logger.debug("Websocket connection details retrieved:\nSocket: %s\nToken: %s", websocket_credentials['data']['socket'], websocket_credentials['data']['token']) + self.logger.debug("""Websocket connection details retrieved: + Socket: %s + Token: %s...""", + websocket_credentials['data']['socket'], + websocket_credentials['data']['token'][:20] + ) + #NOTE - The token is truncated to prevent it from being logged in its entirety, for security reasons except exceptions.ClientConfigError as e: self.logger.error('Failed to initialize Pterodactyl client: %s', e) return @@ -53,7 +60,6 @@ class Pterodactyl(commands.Cog): await websocket.send(auth_message) self.logger.debug("Authentication message sent") - self.client = client self.websocket = websocket while True: