# BotDash.py
https://botdash.pro
---
## Get started
```py
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
```py
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/jetnox/botdash-py",
"name": "botdash.py-dev",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "botdash,discord,bot",
"author": "Jetnox",
"author_email": "support@jetnox.org",
"download_url": "https://files.pythonhosted.org/packages/31/48/d55719c9675e0701fe53ed8845e95911bb7c80f4711ffb0efd90f7974923/botdash.py-dev-1.0.2.tar.gz",
"platform": null,
"description": "# BotDash.py\r\n\r\nhttps://botdash.pro\r\n\r\n---\r\n\r\n## Get started\r\n\r\n\r\n\r\n```py\r\nimport discord\r\nimport botdash\r\nimport time\r\n\r\nDISCORD_TOKEN = \"haha\"\r\nBOTDASH_TOKEN = \"you thought\"\r\n\r\nintents = discord.Intents.all()\r\nclient = discord.Client(intents=intents)\r\ndashboard = botdash.Client(\r\n token=BOTDASH_TOKEN,\r\n return_value=True,\r\n debug=True,\r\n client=client\r\n)\r\n\r\n@dashboard.on(\"change\")\r\nasync def change(data):\r\n # THIS SHOULD ALWAYS BE ASYNC!!!\r\n\r\n #{ key, value, oldValue, guild }\r\n # Key is the key / database ID of the setting.\r\n # Value is the new value of the setting.\r\n # oldValue is the old value of the setting.\r\n # guild is the guild ID of the guild the setting was changed for.\r\n return\r\n\r\n@dashboard.on(\"trigger\")\r\nasync def trigger(data):\r\n # THIS SHOULD ALWAYS BE ASYNC!!!\r\n\r\n # { name, currentSave, guildId }\r\n # Name is the key / database ID of the setting.\r\n # currentSave is the current state/save of the page | [ { Key: Value }, { Key: Value } ]\r\n # guildId is the guild ID of the guild the trigger is for.\r\n return\r\n\r\n@client.event\r\nasync def on_ready():\r\n print('Logged in as')\r\n print(client.user.name)\r\n print(client.user.id)\r\n print('------')\r\n\r\n@client.event\r\nasync def on_message(msg):\r\n if msg.author == client.user:\r\n return\r\n if msg.content.startswith('!get'):\r\n\r\n start_time = time.time()\r\n value = dashboard.get(msg.guild.id, \"prefix\")\r\n end_time = time.time()\r\n\r\n start_time_two = time.time()\r\n valueTwo = dashboard.getUsingRest(msg.guild.id, \"prefix\")\r\n end_time_two = time.time()\r\n\r\n 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}```\")\r\n if msg.content.startswith('!set'):\r\n dashboard.set(msg.guild.id, \"prefix\", msg.content[4:])\r\n await msg.channel.send(f\"Set prefix to {msg.content[4:]}\")\r\n\r\n\r\nclient.run(DISCORD_TOKEN)\r\n```\r\n\r\n### Old Example\r\n```py\r\nfrom botdash import Client\r\n\r\ndash = Client(\r\n token=\"TOKEN_HERE\",\r\n return_value=False, # Set to true\r\n debug=False # Use this for debugging\r\n)\r\nval = dash.get(\"GUILD_ID_HERE\", \"DATABASE_ID_HERE\").value # REMOVE .value if \"return_value\" is True\r\n\r\nprint(val)\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "API wrapper for botdash.pro",
"version": "1.0.2",
"split_keywords": [
"botdash",
"discord",
"bot"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e6626b2730ad1e8e866e123176c58296",
"sha256": "7c0ae03b989bb419a6ab2115123ea7229a61625446e7b0a8a616861e39683701"
},
"downloads": -1,
"filename": "botdash.py_dev-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6626b2730ad1e8e866e123176c58296",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5806,
"upload_time": "2023-01-01T14:13:30",
"upload_time_iso_8601": "2023-01-01T14:13:30.988514Z",
"url": "https://files.pythonhosted.org/packages/e4/97/3689a9ec87c48a4e5bbcfbf0a2e5461255808a23efb25bb4df6b51f3ef4b/botdash.py_dev-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "2d9911fb56b616e170d7aeca2ba71520",
"sha256": "713d16c9c07f909860ef396b08926cfe018a98f3cb5a1350902a2ba2b947d797"
},
"downloads": -1,
"filename": "botdash.py-dev-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "2d9911fb56b616e170d7aeca2ba71520",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5234,
"upload_time": "2023-01-01T14:13:32",
"upload_time_iso_8601": "2023-01-01T14:13:32.280343Z",
"url": "https://files.pythonhosted.org/packages/31/48/d55719c9675e0701fe53ed8845e95911bb7c80f4711ffb0efd90f7974923/botdash.py-dev-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-01 14:13:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jetnox",
"github_project": "botdash-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "botdash.py-dev"
}