Add Pterodactyl cog #19
1 changed files with 1 additions and 2 deletions
|
@ -37,7 +37,7 @@ class Pterodactyl(commands.Cog):
|
||||||
try:
|
try:
|
||||||
client = PterodactylClient(base_url, api_key).client
|
client = PterodactylClient(base_url, api_key).client
|
||||||
websocket_credentials = client.servers.get_websocket(server_id)
|
websocket_credentials = client.servers.get_websocket(server_id)
|
||||||
self.logger.debug(f"Websocket connection details retrieved:\nSocket: {websocket_credentials['data']['socket']}\nToken: {websocket_credentials['data']['token']}")
|
self.logger.debug("Websocket connection details retrieved:\nSocket: %s\nToken: %s", websocket_credentials['data']['socket'], websocket_credentials['data']['token'])
|
||||||
except exceptions.ClientConfigError as e:
|
except exceptions.ClientConfigError as e:
|
||||||
self.logger.error(f'Failed to initialize Pterodactyl client: {e}')
|
self.logger.error(f'Failed to initialize Pterodactyl client: {e}')
|
||||||
return
|
return
|
||||||
|
@ -48,7 +48,6 @@ class Pterodactyl(commands.Cog):
|
||||||
async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket:
|
async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket:
|
||||||
self.logger.debug("WebSocket connection established")
|
self.logger.debug("WebSocket connection established")
|
||||||
|
|
||||||
# Send authentication token
|
|
||||||
auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]})
|
auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]})
|
||||||
await websocket.send(auth_message)
|
await websocket.send(auth_message)
|
||||||
self.logger.debug("Authentication message sent")
|
self.logger.debug("Authentication message sent")
|
||||||
|
|
Loading…
Reference in a new issue