API wrapper for botdash.pro
Project description
BotDash.py
Get started
import discord
import botdash
import time
DISCORD_TOKEN = "haha"
BOTDASH_TOKEN = "you thought"
intents = discord.Intents.all()
client = discord.Client(intents=intents)
dashboard = botdash.Client(
token=BOTDASH_TOKEN,
return_value=True,
debug=True,
client=client
)
@dashboard.on("change")
async def change(data):
# THIS SHOULD ALWAYS BE ASYNC!!!
#{ key, value, oldValue, guild }
# Key is the key / database ID of the setting.
# Value is the new value of the setting.
# oldValue is the old value of the setting.
# guild is the guild ID of the guild the setting was changed for.
return
@dashboard.on("trigger")
async def trigger(data):
# THIS SHOULD ALWAYS BE ASYNC!!!
# { name, currentSave, guildId }
# Name is the key / database ID of the setting.
# currentSave is the current state/save of the page | [ { Key: Value }, { Key: Value } ]
# guildId is the guild ID of the guild the trigger is for.
return
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(msg):
if msg.author == client.user:
return
if msg.content.startswith('!get'):
start_time = time.time()
value = dashboard.get(msg.guild.id, "prefix")
end_time = time.time()
start_time_two = time.time()
valueTwo = dashboard.getUsingRest(msg.guild.id, "prefix")
end_time_two = time.time()
await msg.channel.send(f"```Prefix NEW Method: {value} - Time: {end_time - start_time}\nPrefix OLD Method: {valueTwo} - Time: {end_time_two - start_time_two}```")
if msg.content.startswith('!set'):
dashboard.set(msg.guild.id, "prefix", msg.content[4:])
await msg.channel.send(f"Set prefix to {msg.content[4:]}")
client.run(DISCORD_TOKEN)
Old Example
from botdash import Client
dash = Client(
token="TOKEN_HERE",
return_value=False, # Set to true
debug=False # Use this for debugging
)
val = dash.get("GUILD_ID_HERE", "DATABASE_ID_HERE").value # REMOVE .value if "return_value" is True
print(val)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
botdash.py-dev-1.0.2.tar.gz
(5.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file botdash.py-dev-1.0.2.tar.gz.
File metadata
- Download URL: botdash.py-dev-1.0.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
713d16c9c07f909860ef396b08926cfe018a98f3cb5a1350902a2ba2b947d797
|
|
| MD5 |
2d9911fb56b616e170d7aeca2ba71520
|
|
| BLAKE2b-256 |
3148d55719c9675e0701fe53ed8845e95911bb7c80f4711ffb0efd90f7974923
|
File details
Details for the file botdash.py_dev-1.0.2-py3-none-any.whl.
File metadata
- Download URL: botdash.py_dev-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c0ae03b989bb419a6ab2115123ea7229a61625446e7b0a8a616861e39683701
|
|
| MD5 |
e6626b2730ad1e8e866e123176c58296
|
|
| BLAKE2b-256 |
e4973689a9ec87c48a4e5bbcfbf0a2e5461255808a23efb25bb4df6b51f3ef4b
|