misc(pterodactyl): moved configuration calls into establish_websocket_connection
This commit is contained in:
parent
6e6559d80c
commit
9d4d8b8267
1 changed files with 5 additions and 5 deletions
|
@ -25,7 +25,10 @@ class Pterodactyl(commands.Cog):
|
||||||
self.client = None
|
self.client = None
|
||||||
self.websocket = None
|
self.websocket = None
|
||||||
|
|
||||||
async def establish_websocket_connection(self, base_url, api_key, server_id):
|
async def establish_websocket_connection(self):
|
||||||
|
base_url = await self.config.base_url()
|
||||||
|
api_key = await self.config.api_key()
|
||||||
|
server_id = await self.config.server_id()
|
||||||
try:
|
try:
|
||||||
client = PterodactylClient(base_url, api_key).client
|
client = PterodactylClient(base_url, api_key).client
|
||||||
websocket_credentials = client.servers.get_websocket(server_id)
|
websocket_credentials = client.servers.get_websocket(server_id)
|
||||||
|
@ -61,10 +64,7 @@ class Pterodactyl(commands.Cog):
|
||||||
self.logger.debug("Received message: %s", message)
|
self.logger.debug("Received message: %s", message)
|
||||||
|
|
||||||
async def cog_load(self):
|
async def cog_load(self):
|
||||||
base_url = await self.config.base_url()
|
await self.establish_websocket_connection()
|
||||||
api_key = await self.config.api_key()
|
|
||||||
server_id = await self.config.server_id()
|
|
||||||
await self.establish_websocket_connection(base_url, api_key, server_id)
|
|
||||||
|
|
||||||
async def cog_unload(self):
|
async def cog_unload(self):
|
||||||
await self.client._session.close()
|
await self.client._session.close()
|
||||||
|
|
Loading…
Reference in a new issue