feat(pterodactyl): use red's api key storage system for api key storage and not a config key
This commit is contained in:
parent
7e03696e10
commit
afc5868e9e
2 changed files with 19 additions and 11 deletions
|
@ -114,9 +114,19 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
|
|||
await chat.send(await config.shutdown_msg())
|
||||
|
||||
async def retrieve_websocket_credentials(coginstance: Pterodactyl) -> Optional[dict]:
|
||||
pterodactyl_keys = await coginstance.bot.get_shared_api_tokens("pterodactyl")
|
||||
api_key = pterodactyl_keys.get("api_key")
|
||||
if api_key is None:
|
||||
coginstance.task.cancel()
|
||||
return logger.error("Pterodactyl API key not set. Please set it using `[p]set api`.")
|
||||
base_url = await config.base_url()
|
||||
api_key = await config.api_key()
|
||||
if base_url is None:
|
||||
coginstance.task.cancel()
|
||||
return logger.error("Pterodactyl base URL not set. Please set it using `[p]ptero set url`.")
|
||||
server_id = await config.server_id()
|
||||
if server_id is None:
|
||||
coginstance.task.cancel()
|
||||
return logger.error("Pterodactyl server ID not set. Please set it using `[p]ptero set serverid`.")
|
||||
|
||||
try:
|
||||
client = PterodactylClient(base_url, api_key, debug=True).client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue