diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 704e6c8..aa819a7 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -12,11 +12,11 @@ class Pterodactyl(commands.Cog): def __init__(self, bot: Red): self.bot = bot - self.config = Config.get_conf(self, identifier=457581387213637448123567) + self.config = Config.get_conf(self, identifier=457581387213637448123567, force_registration=True) self.config.register_global( - base_url='https://mc.bloom.host', - api_key='ptlc_G1leFiGsBXeo4lkRasXOMUJhE1aXnygQmg2AKgLKNjk', - server_id='5756a968', + base_url=None, + api_key=None, + server_id=None, startup_jar=None, startup_arguments=None, power_action_in_progress=False @@ -40,7 +40,7 @@ class Pterodactyl(commands.Cog): 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) self.logger.debug("Authentication message sent") @@ -49,6 +49,9 @@ class Pterodactyl(commands.Cog): while True: message = await websocket.recv() + if json.loads(message)['event'] == 'token expiring': + websocket_credentials = client.servers.get_websocket(server_id) + auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]}) self.logger.debug("Received message: %s", message) async def cog_load(self):