Skip to main content

Installing

pip install discloud

Dev installing

Note: need https://git-scm.com to download

pip install git+https://github.com/discloud/python-discloud-status@master

Usage

Get Started

First of all, you need to get your Discloud API-Token. You can create a new one by typing .api in the Discloud Server. If you're in trouble on getting your Discloud API-Token, you can DM the Ticket bot (DisCloud ModMail#6424) in the server. The supporters will be glad on helping you

Understanding the returns

Action

All methods that doesn't get information(e.g. start app/change ram/add mod) returns an Action. It has .status attribute, which is either "ok" when no issues happened, or "error" when something happened. It also contains .message attribute which is always returned when an error ocurrs, and is given on almost all actions.

Backup

Backup has a .url attribute that gives the application's backup link.

Logs

Logs has a .small attribute which returns the last ~1800 chars of your app logs, and a .full attribute that gives the complete logs

User

WIP

Application

WIP

Creating a client

import discloud
client = discloud.Client("API-Token")

Userinfo

user = await client.user_info()
print(f"ID: '{user.id}'")
plan = user.plan
print(f"Plan '{plan}'")
print(f"Expire date '{plan.expire_date}'")
print(f"Ends in '{plan.expires_in}'")
print(f"Used ram '{user.using_ram}'")
print(f"Total ram '{user.total_ram}'")
print(f"Locale '{user.locale}'")

Application

Info

bot = await client.app_info(target="APP_ID")
print(f"ID '{bot.id}'")
print(f"Status '{bot.status}'")
print(f"CPU '{bot.cpu}'")
print(f"Memory '{bot.memory}'")
print(f"Memory available '{bot.memory.available}'")
print(f"Using memory '{bot.memory.using}'")
print(f"Mem usada '{bot.memory.using}'")
print(f"SSD '{bot.ssd}'")
print(f"Download '{bot.net_info.download}'")
print(f"Upload '{bot.net_info.upload}'")
print(f"Online since '{bot.online_since}'")
print(f"Started at '{bot.start_date}'")

Logs

Client.app_logs() returns a Logs. The.logs attribute will give you the full logs content, .small_logs will give the last 1800 characters

logs = await client.logs(target="APP_ID")

print(logs.full) # complete logs
print(logs.small) # around last 1800 characters of your logs

Start/Restart/Stop

Client.start()/Client.restart()/Client.stop() returns an Action.

# note: don't expect to get the results there if you use inside of your bot since its going to get shutdown
start_result = await client.start(target="APP_ID")
restart_result = await client.restart(target="APP_ID")
stop_result = await client.stop(target="APP_ID")

print(start_result) # See if the start was successful
print(restart_result) # See if the restart was successful
print(stop_result) # See if the stop was successful

Commit

Client.commit() returns an Action.

# note: this always restart your bot so you won't get a result if its inside of your bot
file = discloud.File("eggs.zip") # Must be .zip
result = await client.commit(app_id="APP_ID", file=file)

print(result.message) # See if the commit was successful

Backup

Client.backup() returns a Backup. The .url attribute will give you the link

backup = await client.backup(target="APP_ID")
print(backup.url) # Get backup url

Update Ram

Client.ram() returns an Action.

result = await client.ram(app_id="APP_ID", NEW_RAM)
print(result.message) # See if ram memory was updated

Upload

Client.upload_app() returns an Action. Note: the .zip must have a discloud.config file, more info at documentation

result = await client.upload_app(file=discloud.File("my_bot.zip"))
print(result.message) # See if the app was successfully added

Delete

Client.delete_app() returns an Action.

result = await client.delete_app(app_id="APP_ID")
print(result.message) # See if the app was successfully deleted

Mods System

First you need to setup a specific client to manage bot mods or manage a bot as mod.

import discloud

client = discloud.Client("API-Token")
mod_client = discloud.ModManager(client, "APP_ID")

Second, be aware of what mods can currently do, actually they can have one or more of these permissions: "start_app", "stop_app", "restart_app", "logs_app", "commit_app", "edit_ram", "backup_app", "status_app"

Application Owners

To add a moderator to your app you must first have a Gold Plan or above.

Adding a moderator

ModManager.add_mod()

permissions = ["start_app"]
await mod_client.add_mod(mod_id="MOD_ID", permissions)
Removing a moderator

ModManager.remove_mod()

await mod_client.remove_mod(mod_id="MOD_ID")
Changing moderator permissions

ModManager.edit_mod_perms()

new_permissions = ["start_app", "restart_app"] # note: this remove existing perms if they are not there
await mod_client.edit_mod_perms(mod_id="MOD_ID", new_permissions)
Getting all moderators

ModManager.get_mods()

mods = await mod_client.get_mods()
print(mods) # 

Application moderators

For each command you can do you will need the respective permission as mentioned above Commands: ModManager.start(), ModManager.restart(), ModManager.stop(), ModManager.commit(), ModManager.backup(), ModManager.logs(), ModManager.ram(), ModManager.status(),

Metadata

Release files for discloud 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discloud 1.0.1
File Size Uploaded Provenance
discloud-1.0.1.tar.gz 13.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for discloud 1.0.1
File Interpreter ABI Platform
discloud-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / discloud-1.0.1.tar.gz

Download URL discloud-1.0.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2ad0d24a053b4e990952fc09a84953417515c8f77216ec1e70f53b6b8a3e479
BLAKE2b-256 checksum
How to use checksums
f216f2dd8961de654104aaef2cf647c3bffaabd5d7eed17b16a2fb3ea6027711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release files / discloud-1.0.1-py3-none-any.whl

Download URL discloud-1.0.1-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2fbf27925b5ac990a33c5da3f6a59ef5ed58bfafb5487a2a8925083380729a4
BLAKE2b-256 checksum
How to use checksums
c8dafc6bb16764b683dd34d306819a0342b335cc8c12c355a43db4b29a9f980f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Security for discloud 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page