Files
MercuryCloud_Dashboard/node_modules/@devnote-dev/pterojs/README.md
SavaletDev 9dfd50b963 Init
2022-04-22 23:02:19 +02:00

2.8 KiB

pterojs-logo

PteroJS

A better API wrapper for Pterodactyl

Logo design by aizakkusnail#1065 (Discord)

About

PteroJS is a flexible API wrapper designed to give developers full access over the Pterodactyl API. The library uses a class-based management structure often seen in popular packages like Discord.js which keeps code clean, efficient and practical for any use-case.

Installing

npm install @devnote-dev/pterojs

Please join the support server if you experience package installation issues.

Setting Up

PteroJS uses separate classes for the client and application sides of the Pterodactyl API.

Using the application API

const { PteroApp } = require('@devnote-dev/pterojs');

// Initialising the application
const client = new PteroApp('your.domain.here', 'pterodactyl_api_key');

// Connecting to Pterodactyl
client.connect();

// Accessing information
client.servers.fetch('evuk98yu').then(console.log);

Using the client API

const { PteroClient } = require('@devnote-dev/pterojs');

// Initialising the client
const client = new PteroClient(
    'your.domain.here',
    'pterodactyl_api_key',
    { ws: true }
);

// Adding servers to listen for
client.addSocksetServer([ 'kgujg66h', 'avipgt6e' ]);

// Listening to events
client.on('statusUpdate', (server, status) => {
    console.log(`${server.name} status: ${status}`);
});

// Connecting to Pterodactyl
client.connect();

Contributing

Please see the todo list or issues section for contributing ideas. New ideas are also welcome.

  1. Fork this repo!
  2. Make a branch from main (git branch -b <new-feature>)
  3. Commit your changes (git commit -am "...")
  4. Open a PR here (git push origin <new-feature>)

Contributors

This repository is managed under the MIT license.

© 2021 devnote-dev