Add Pterodactyl cog #19
2 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,6 @@ import asyncio
|
||||||
import json
|
import json
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import websockets
|
import websockets
|
||||||
from pydactyl import PterodactylClient
|
from pydactyl import PterodactylClient
|
||||||
|
@ -12,7 +11,6 @@ from redbot.core.utils.chat_formatting import box
|
||||||
|
|
||||||
from pterodactyl.config import config
|
from pterodactyl.config import config
|
||||||
from pterodactyl.logger import logger
|
from pterodactyl.logger import logger
|
||||||
from pterodactyl.websocket import establish_websocket_connection
|
|
||||||
|
|
||||||
|
|
||||||
class Pterodactyl(commands.Cog):
|
class Pterodactyl(commands.Cog):
|
||||||
|
@ -32,6 +30,7 @@ class Pterodactyl(commands.Cog):
|
||||||
await self.client._session.close() # pylint: disable=protected-access
|
await self.client._session.close() # pylint: disable=protected-access
|
||||||
|
|
||||||
def get_task(self) -> asyncio.Task:
|
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 = self.bot.loop.create_task(establish_websocket_connection(self), name="Pterodactyl Websocket Connection")
|
||||||
task.add_done_callback(self.error_callback)
|
task.add_done_callback(self.error_callback)
|
||||||
return task
|
return task
|
||||||
|
|
|
@ -13,6 +13,7 @@ from pterodactyl.logger import logger
|
||||||
from pterodactyl.pterodactyl import Pterodactyl
|
from pterodactyl.pterodactyl import Pterodactyl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
||||||
logger.debug("Establishing WebSocket connection")
|
logger.debug("Establishing WebSocket connection")
|
||||||
base_url = await config.base_url()
|
base_url = await config.base_url()
|
||||||
|
|
Loading…
Reference in a new issue