fix(pterodactyl): awaited a coroutine

This commit is contained in:
Seaswimmer 2024-02-28 11:52:35 -05:00
parent d391aeeb7b
commit 08cd13d7c7
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -74,11 +74,11 @@ class Pterodactyl(commands.Cog):
websocket_credentials = client.servers.get_websocket(server_id)
continue
def get_task(self):
return self.bot.loop.create_task(self.establish_websocket_connection(), name="Pterodactyl Websocket Connection")
async def get_task(self):
return self.bot.loop.create_task(await self.establish_websocket_connection(), name="Pterodactyl Websocket Connection")
async def cog_load(self):
self.task = self.get_task()
self.task = await self.get_task()
async def cog_unload(self):
self.task.cancel()
@ -99,7 +99,7 @@ class Pterodactyl(commands.Cog):
await ctx.send(f"Base URL set to {base_url}")
self.logger.debug("Configuration value set: base_url = %s\nRestarting task...", base_url)
self.task.cancel()
self.task = self.get_task()
self.task = await self.get_task()
@pterodactyl_config.command(name = "apikey")
async def pterodactyl_config_api_key(self, ctx: commands.Context, api_key: str):
@ -108,7 +108,7 @@ class Pterodactyl(commands.Cog):
await ctx.send(f"API key set to `{api_key[:5]}...{api_key[-4:]}`")
self.logger.debug("Configuration value set: api_key = %s\nRestarting task...", api_key)
self.task.cancel()
self.task = self.get_task()
self.task = await self.get_task()
@pterodactyl_config.command(name = "serverid")
async def pterodactyl_config_server_id(self, ctx: commands.Context, server_id: str):
@ -117,4 +117,4 @@ class Pterodactyl(commands.Cog):
await ctx.send(f"Server ID set to {server_id}")
self.logger.debug("Configuration value set: server_id = %s\nRestarting task...", server_id)
self.task.cancel()
self.task = self.get_task()
self.task = await self.get_task()