Add Pterodactyl cog #19

Merged
cswimr merged 139 commits from pterodactyl into main 2024-03-02 00:07:42 -05:00
Showing only changes of commit 2017cbb226 - Show all commits

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: