Skip to content

The Main Module

Devonte edited this page Jul 19, 2021 · 1 revision

The Main Module

This page will cover the setup and general usage of the wrapper.

Setting Up

This is relatively simple, first install the module via the command line:

Windows

pip install -U git+https://github.com/devnote-dev/dashactyl.py

Next, open Python in whatever text editor you use (VSC is superior) and create a new client:

from dashactyl import Dashactyl

client = Dashactyl(domain='your.domain.here', auth='auth_key_here')

Parameters

  • domain - The domain for your Dashactyl panel NOT your Pterodactyl domain
  • auth - The authentication key for your Pterodactyl panel

Congrats, you completed Python basics 101!

Accessing classes

Currently, the client class gives you access to the users, servers, and coupons classes, all through their respective names. Each class also stores fetched data in its cache which you can access via the .get method in the classes or via .cache directly. Here are some examples:

Managing users

user = client.users.get(622146791659405313)
print(user.tag) # prints: Devonte#0745

response = client.users.remove(user)
print(response) # if nothing prints, you've done it right

Managing servers

server = client.servers.get('qweryuioop')
print(server.name, server.limits['cpu']) # prints: 'Fake Testing Server' 15

server.modify(cpu=30)
print(server.limits['cpu']) # prints: 30

Managing coupons

coupon = client.coupons.get('somecoupon')
print(coupon.servers) # throws an error because the coupon doesn't exist

coupon = client.coupons.create(coins=100)
print(coupon.code) # prints: $omeCoup0nCode
print(coupon.coins) # prints: 100
print(coupon.servers) # wasn't added to the coupon, so prints: 0

Clone this wiki locally