Add Pterodactyl cog #19
1 changed files with 39 additions and 42 deletions
|
@ -29,11 +29,8 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
||||||
logger.debug("Authentication message sent")
|
logger.debug("Authentication message sent")
|
||||||
|
|
||||||
coginstance.websocket = websocket
|
coginstance.websocket = websocket
|
||||||
|
|
||||||
await loop(coginstance, websocket)
|
|
||||||
|
|
||||||
async def loop(coginstance: Pterodactyl, websocket: websockets.WebSocketClientProtocol) -> None:
|
|
||||||
current_status = ''
|
current_status = ''
|
||||||
|
|
||||||
while True: # pylint: disable=too-many-nested-blocks
|
while True: # pylint: disable=too-many-nested-blocks
|
||||||
message = await websocket.recv()
|
message = await websocket.recv()
|
||||||
if json.loads(message)['event'] in ('token expiring', 'token expired'):
|
if json.loads(message)['event'] in ('token expiring', 'token expired'):
|
||||||
|
|
Loading…
Reference in a new issue