- Notifications
You must be signed in to change notification settings - Fork 2
The Main Module
Devonte edited this page Jul 19, 2021
·
1 revision
This page will cover the setup and general usage of the wrapper.
This is relatively simple, first install the module via the command line:
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:
fromdashactylimportDashactylclient=Dashactyl(domain='your.domain.here', auth='auth_key_here')domain- The domain for your Dashactyl panel NOT your Pterodactyl domainauth- The authentication key for your Pterodactyl panel
Congrats, you completed Python basics 101!
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:
user=client.users.get(622146791659405313)
print(user.tag) # prints: Devonte#0745response=client.users.remove(user)
print(response) # if nothing prints, you've done it rightserver=client.servers.get('qweryuioop')
print(server.name, server.limits['cpu']) # prints: 'Fake Testing Server' 15server.modify(cpu=30)
print(server.limits['cpu']) # prints: 30coupon=client.coupons.get('somecoupon')
print(coupon.servers) # throws an error because the coupon doesn't existcoupon=client.coupons.create(coins=100)
print(coupon.code) # prints: $omeCoup0nCodeprint(coupon.coins) # prints: 100print(coupon.servers) # wasn't added to the coupon, so prints: 0