Add Pterodactyl cog #19
2 changed files with 3 additions and 1 deletions
|
@ -44,7 +44,7 @@ class Pterodactyl(commands.Cog):
|
||||||
except Exception as e: # pylint: disable=broad-exception-caught
|
except Exception as e: # pylint: disable=broad-exception-caught
|
||||||
logger.error("WebSocket task has failed: %s", e, exc_info=e)
|
logger.error("WebSocket task has failed: %s", e, exc_info=e)
|
||||||
self.task.cancel()
|
self.task.cancel()
|
||||||
self.task = self.get_task()
|
# self.task = self.get_task()
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message_without_command(self, message: discord.Message) -> None:
|
async def on_message_without_command(self, message: discord.Message) -> None:
|
||||||
|
|
|
@ -21,6 +21,8 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
||||||
|
|
||||||
websocket_credentials = await retrieve_websocket_credentials(coginstance)
|
websocket_credentials = await retrieve_websocket_credentials(coginstance)
|
||||||
|
|
||||||
|
logger.info("WebSocket connection details retrieved\n%s\n%s", json.dumps(websocket_credentials), base_url)
|
||||||
|
|
||||||
async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60) as websocket:
|
async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60) as websocket:
|
||||||
logger.info("WebSocket connection established")
|
logger.info("WebSocket connection established")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue