Add Pterodactyl cog #19
1 changed files with 2 additions and 1 deletions
|
@ -4,7 +4,6 @@ import re
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import discord
|
import discord
|
||||||
import websockets
|
import websockets
|
||||||
|
@ -22,6 +21,8 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
||||||
logger.info("Establishing WebSocket connection")
|
logger.info("Establishing WebSocket connection")
|
||||||
|
|
||||||
websocket_credentials = await retrieve_websocket_credentials(coginstance)
|
websocket_credentials = await retrieve_websocket_credentials(coginstance)
|
||||||
|
if not websocket_credentials:
|
||||||
|
return logger.error("Failed to retrieve WebSocket credentials. WebSocket connection not established")
|
||||||
|
|
||||||
async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60, logger=getLogger("red.sea.pterodactyl.websocket")) as websocket:
|
async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60, logger=getLogger("red.sea.pterodactyl.websocket")) as websocket:
|
||||||
logger.info("WebSocket connection established")
|
logger.info("WebSocket connection established")
|
||||||
|
|
Loading…
Reference in a new issue