cleanup(pterodactyl): making some changes to establish_websocket_connection
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s

This commit is contained in:
Seaswimmer 2024-02-28 13:00:11 -05:00
parent caa03a63e6
commit 2017cbb226
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -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: