cleanup(pterodactyl): making some changes to establish_websocket_connection

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

View file

@ -36,8 +36,15 @@ class Pterodactyl(commands.Cog):
try: try:
client = PterodactylClient(base_url, api_key, debug=True).client client = PterodactylClient(base_url, api_key, debug=True).client
self.client = client
websocket_credentials = client.servers.get_websocket(server_id) 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: except exceptions.ClientConfigError as e:
self.logger.error('Failed to initialize Pterodactyl client: %s', e) self.logger.error('Failed to initialize Pterodactyl client: %s', e)
return return
@ -53,7 +60,6 @@ class Pterodactyl(commands.Cog):
await websocket.send(auth_message) await websocket.send(auth_message)
self.logger.debug("Authentication message sent") self.logger.debug("Authentication message sent")
self.client = client
self.websocket = websocket self.websocket = websocket
while True: while True: