Add Pterodactyl cog #19
1 changed files with 8 additions and 5 deletions
|
@ -12,11 +12,11 @@ class Pterodactyl(commands.Cog):
|
||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
self.bot = bot
|
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(
|
self.config.register_global(
|
||||||
base_url='https://mc.bloom.host',
|
base_url=None,
|
||||||
api_key='ptlc_G1leFiGsBXeo4lkRasXOMUJhE1aXnygQmg2AKgLKNjk',
|
api_key=None,
|
||||||
server_id='5756a968',
|
server_id=None,
|
||||||
startup_jar=None,
|
startup_jar=None,
|
||||||
startup_arguments=None,
|
startup_arguments=None,
|
||||||
power_action_in_progress=False
|
power_action_in_progress=False
|
||||||
|
@ -40,7 +40,7 @@ class Pterodactyl(commands.Cog):
|
||||||
self.logger.debug("WebSocket connection established")
|
self.logger.debug("WebSocket connection established")
|
||||||
|
|
||||||
# Send authentication token
|
# 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")
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ class Pterodactyl(commands.Cog):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
message = await websocket.recv()
|
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)
|
self.logger.debug("Received message: %s", message)
|
||||||
|
|
||||||
async def cog_load(self):
|
async def cog_load(self):
|
||||||
|
|
Loading…
Reference in a new issue