ForgeScript extension for interacting with the Pterodactyl API (Client Category)
npm install @quoriel/pterodactyl
npm i github:quoriel/pterodactyl
`Connection
`js
const { ForgeClient } = require("@tryforge/forgescript");
const { QuorielPterodactyl } = require("@quoriel/pterodactyl");const client = new ForgeClient({
extensions: [
// Configuration for your Pterodactyl panels
new QuorielPterodactyl({
"main_panel": {
"url": "PTERO_URL",
"key": "PTERO_KEY"
},
"second_panel": {
"url": "SECOND_PTERO_URL",
"key": "SECOND_PTERO_KEY",
"headers": {
"User-Agent": "Quoriel/1.0"
}
}
})
]
});
client.login("...");
`Configure Environment Variables
The url and key values are not specified directly in the code. Instead, you provide the names of environment variables that hold these values. This is a security best practice.
Create a .env file in your project's root directory and add your credentials:`env
Credentials for the "main_panel" configuration
PTERO_URL=panel.example.com
PTERO_KEY=ptlc_YourSuperSecretApiKeyHereCredentials for the "second_panel" configuration
SECOND_PTERO_URL=another-panel.net
SECOND_PTERO_KEY=ptlc_AnotherApiKeyFromSecondPanel
`> Note
> The key in the configuration object (e.g.,
main_panel`) is the identifier you will use in functions to specify which panel to send the request to.