pterodactyl.ts
v1.1.3
Published
Easily manage your panel and servers on a Pterodactyl panel
Downloads
198
Maintainers
Readme
Pterodactyl.ts
This is a easy to use typescript based api wrapper for the pterodactyl api.
Quick start
Most functions are tested, if something doesn't work please open an issue on github.
ApplicationClient
With the ApplicationClient you can manage servers, nodes, users, and more.
import { ApplicationClient } from 'pterodactyl.ts';
const applicationClient = new ApplicationClient({
apikey: '',
panel: '',
});
UserClient
With the ApplicationClient you can manage servers, subusers, backups, files and more.
import { UserClient } from 'pterodactyl.ts';
const userClient = new UserClient({
apikey: '',
panel: '',
});
// Get a specific server from your account
import { SocketEvent } from 'pterodactyl.ts';
const server = await userClient.getServer('someId');
/**
* Console connection
*/
// The authentication is done automatically
const socket = await server.getConsoleSocket();
await socket.connect(true);
// Get the logs, when the server is offline you'll receive a generated log message
const logs = await socket.getLogs();
// Get live console logging
socket.on(SocketEvent.CONSOLE_OUTPUT, (log) => {
console.log(log);
});
socket.disconnect();
/**
* File management
*/
// Accepts a filepath, buffer or blob
await server.uploadFile('/', 'hello.world', 'hello.world');
Disclaimer
Use is at own risk!
You can easily delete everything - be cautious!