diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index c279715..8492f84 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -25,7 +25,10 @@ class Pterodactyl(commands.Cog): self.client = 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: client = PterodactylClient(base_url, api_key).client websocket_credentials = client.servers.get_websocket(server_id) @@ -61,10 +64,7 @@ class Pterodactyl(commands.Cog): self.logger.debug("Received message: %s", message) async def cog_load(self): - base_url = await self.config.base_url() - 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) + await self.establish_websocket_connection() async def cog_unload(self): await self.client._session.close()