From 7f8d70ccaea84457df9551b37dd86746a621a47d Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 29 Feb 2024 23:33:00 -0500 Subject: [PATCH] fix(pterodactyl): fixed circular import --- pterodactyl/pterodactyl.py | 3 +-- pterodactyl/websocket.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 87ada6b..0e05ff1 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -2,7 +2,6 @@ import asyncio import json from typing import Optional - import discord import websockets from pydactyl import PterodactylClient @@ -12,7 +11,6 @@ from redbot.core.utils.chat_formatting import box from pterodactyl.config import config from pterodactyl.logger import logger -from pterodactyl.websocket import establish_websocket_connection class Pterodactyl(commands.Cog): @@ -32,6 +30,7 @@ class Pterodactyl(commands.Cog): await self.client._session.close() # pylint: disable=protected-access def get_task(self) -> asyncio.Task: + from pterodactyl.websocket import establish_websocket_connection task = self.bot.loop.create_task(establish_websocket_connection(self), name="Pterodactyl Websocket Connection") task.add_done_callback(self.error_callback) return task diff --git a/pterodactyl/websocket.py b/pterodactyl/websocket.py index 02701c2..ba7a164 100644 --- a/pterodactyl/websocket.py +++ b/pterodactyl/websocket.py @@ -13,6 +13,7 @@ from pterodactyl.logger import logger from pterodactyl.pterodactyl import Pterodactyl + async def establish_websocket_connection(coginstance: Pterodactyl) -> None: logger.debug("Establishing WebSocket connection") base_url = await config.base_url()