Add Pterodactyl cog #19
1 changed files with 4 additions and 6 deletions
|
@ -41,10 +41,10 @@ class Pterodactyl(commands.Cog):
|
||||||
websocket_credentials = client.servers.get_websocket(server_id)
|
websocket_credentials = client.servers.get_websocket(server_id)
|
||||||
self.logger.debug("Websocket connection details retrieved:\nSocket: %s\nToken: %s", websocket_credentials['data']['socket'], websocket_credentials['data']['token'])
|
self.logger.debug("Websocket connection details retrieved:\nSocket: %s\nToken: %s", websocket_credentials['data']['socket'], websocket_credentials['data']['token'])
|
||||||
except exceptions.ClientConfigError as e:
|
except exceptions.ClientConfigError as e:
|
||||||
self.logger.error(f'Failed to initialize Pterodactyl client: {e}')
|
self.logger.error('Failed to initialize Pterodactyl client: %s', e)
|
||||||
return
|
return
|
||||||
except exceptions.PterodactylApiError as e:
|
except exceptions.PterodactylApiError as e:
|
||||||
self.logger.error(f'Failed to retrieve Pterodactyl websocket: {e}')
|
self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e)
|
||||||
return
|
return
|
||||||
|
|
||||||
async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket:
|
async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket:
|
||||||
|
@ -77,17 +77,15 @@ class Pterodactyl(commands.Cog):
|
||||||
|
|
||||||
async def cog_unload(self):
|
async def cog_unload(self):
|
||||||
self.task.cancel()
|
self.task.cancel()
|
||||||
await self.client._session.close()
|
await self.client._session.close() # pylint: disable=protected-access
|
||||||
|
|
||||||
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
||||||
async def pterodactyl(self, ctx: commands.Context):
|
async def pterodactyl(self, ctx: commands.Context):
|
||||||
"""Pterodactyl allows you to manage your Pterodactyl Panel from Discord."""
|
"""Pterodactyl allows you to manage your Pterodactyl Panel from Discord."""
|
||||||
pass
|
|
||||||
|
|
||||||
@pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"])
|
@pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"])
|
||||||
async def pterodactyl_config(self, ctx: commands.Context):
|
async def pterodactyl_config(self, ctx: commands.Context):
|
||||||
"""Configure Pterodactyl settings."""
|
"""Configure Pterodactyl settings."""
|
||||||
pass
|
|
||||||
|
|
||||||
@pterodactyl_config.command(name = "url")
|
@pterodactyl_config.command(name = "url")
|
||||||
async def pterodactyl_config_base_url(self, ctx: commands.Context, base_url: str):
|
async def pterodactyl_config_base_url(self, ctx: commands.Context, base_url: str):
|
||||||
|
|
Loading…
Reference in a new issue