<p align="center">
<a href="https://discord.gg/Em2ZwkVbfE">
<img alt="Discord Server"
src="https://discord.com/api/guilds/1010915072694046794/embed.png" />
</a>
<a href="https://opensource.org/licenses/MIT">
<img alt="License"
src="https://img.shields.io/badge/License-MIT-yellow.svg" />
</a>
<a href="https://pypi.org/project/discord-ext-dash/">
<img alt="Version"
src="https://img.shields.io/pypi/v/discord-ext-dashboard.svg?text=version" />
</a>
<a href="https://pypi.org/project/discord-ext-dash/">
<img alt="Downloads"
src="https://img.shields.io/pypi/dm/discord-ext-dashboard.svg" />
</a>
<a href="https://pypi.org/project/discord-ext-dash/">
<img alt="Supported Versions"
src="https://img.shields.io/pypi/pyversions/discord-ext-dashboard.svg" />
</a>
</p>
<h1 align=center>discord-ext-dash</h1>
<p align=center>A webhook and request based discord.py extension for making a bot dashboard.</p>
## Installation
```py
pip install --upgrade discord-ext-dash
# If that doesn't work
python3 -m pip install --upgrade discord-ext-dash
```
## Usage
### Prerequisites
Before you get started, you will need a few things:
- A webhook in secret channel (if anyone has access, they will be able to mess things up).
- A properly hosted [**discord.py**](https://github.com/Rapptz/discord.py) bot
And then you're ready to get started!
### Examples
#### Bot
```py
import discord
from discord.ext import commands
from discord.ext.dash import Dashboard
bot = commands.Bot(command_prefix="!")
bot_dashboard = Dashboard(bot,
"secret_key",
"https://your-bot-website.com/dashboard"
)
@bot.event
async def on_ready():
print(f"Bot is online as {bot.user}")
@bot.event
async def on_message(message):
await bot_dashboard.process_request(message)
@bot_dashboard.route
async def guild_count(data):
return len(bot.guilds)
@bot_dashboard.route
async def member_count(data):
return await bot.fetch_guild(data["guild_id"]).member_count
bot.run("your-token-here")
```
#### Webserver
```py
from quart import Quart, request
from discord.ext.dash import Server
app = Quart(__name__)
app_dashboard = Server(
app,
"secret_key",
webhook_url="https://your-private-discord-webhook.com",
sleep_time=1
)
@app.route("/")
async def index():
guild_count = await app_dashboard.request("guild_count")
member_count = await app_dashboard.request("member_count", guild_id=776230580941619251)
return f"Guild count: {guild_count}, Server member count: {member_count}"
@app.route("/dashboard", methods=["POST"])
async def dashboard():
# Don't worry about authorization, the bot will handle it
await app_dashboard.process_request(request)
if __name__ == "__main__":
app.run()
```
Please note that cogs are not currently supported.
<br>
You will also need to use Quart as your webserver. Switching from another library isn't hard, so ask me and I'll gladly help you out.
<br><br>
Raw data
{
"_id": null,
"home_page": "https://github.com/timoo4devv/discord-ext-dash",
"name": "discord-ext-dash",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5.3",
"maintainer_email": "",
"keywords": "",
"author": "Timo",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/15/60/c02ed0c6955b75cf1c80067dcfda1eae369ede48f1d7365b6c273676dd71/discord-ext-dash-0.3.1.tar.gz",
"platform": null,
"description": "<p align=\"center\">\r\n <a href=\"https://discord.gg/Em2ZwkVbfE\">\r\n <img alt=\"Discord Server\"\r\n src=\"https://discord.com/api/guilds/1010915072694046794/embed.png\" />\r\n </a>\r\n <a href=\"https://opensource.org/licenses/MIT\">\r\n <img alt=\"License\"\r\n src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" />\r\n </a>\r\n <a href=\"https://pypi.org/project/discord-ext-dash/\">\r\n <img alt=\"Version\"\r\n src=\"https://img.shields.io/pypi/v/discord-ext-dashboard.svg?text=version\" />\r\n </a>\r\n <a href=\"https://pypi.org/project/discord-ext-dash/\">\r\n <img alt=\"Downloads\"\r\n src=\"https://img.shields.io/pypi/dm/discord-ext-dashboard.svg\" />\r\n </a>\r\n <a href=\"https://pypi.org/project/discord-ext-dash/\">\r\n <img alt=\"Supported Versions\"\r\n src=\"https://img.shields.io/pypi/pyversions/discord-ext-dashboard.svg\" />\r\n </a>\r\n</p>\r\n\r\n<h1 align=center>discord-ext-dash</h1>\r\n<p align=center>A webhook and request based discord.py extension for making a bot dashboard.</p>\r\n\r\n## Installation\r\n```py\r\npip install --upgrade discord-ext-dash\r\n\r\n# If that doesn't work\r\npython3 -m pip install --upgrade discord-ext-dash\r\n```\r\n\r\n## Usage\r\n### Prerequisites\r\nBefore you get started, you will need a few things:\r\n - A webhook in secret channel (if anyone has access, they will be able to mess things up).\r\n - A properly hosted [**discord.py**](https://github.com/Rapptz/discord.py) bot\r\n \r\n And then you're ready to get started!\r\n\r\n### Examples\r\n#### Bot\r\n```py\r\nimport discord\r\nfrom discord.ext import commands\r\nfrom discord.ext.dash import Dashboard\r\n\r\nbot = commands.Bot(command_prefix=\"!\")\r\nbot_dashboard = Dashboard(bot,\r\n\t\"secret_key\", \r\n\t\"https://your-bot-website.com/dashboard\"\r\n)\r\n\r\n@bot.event\r\nasync def on_ready():\r\n\tprint(f\"Bot is online as {bot.user}\")\r\n\r\n@bot.event\r\nasync def on_message(message):\r\n\tawait bot_dashboard.process_request(message)\r\n\r\n@bot_dashboard.route\r\nasync def guild_count(data):\r\n\treturn len(bot.guilds)\r\n\r\n@bot_dashboard.route\r\nasync def member_count(data):\r\n\treturn await bot.fetch_guild(data[\"guild_id\"]).member_count\r\n\r\nbot.run(\"your-token-here\")\r\n```\r\n\r\n\r\n#### Webserver\r\n```py\r\nfrom quart import Quart, request\r\nfrom discord.ext.dash import Server\r\n\r\napp = Quart(__name__)\r\napp_dashboard = Server(\r\n\tapp,\r\n\t\"secret_key\", \r\n\twebhook_url=\"https://your-private-discord-webhook.com\",\r\n\tsleep_time=1\r\n)\r\n\r\n@app.route(\"/\")\r\nasync def index():\r\n\tguild_count = await app_dashboard.request(\"guild_count\")\r\n\tmember_count = await app_dashboard.request(\"member_count\", guild_id=776230580941619251)\r\n\r\n\treturn f\"Guild count: {guild_count}, Server member count: {member_count}\"\r\n\r\n@app.route(\"/dashboard\", methods=[\"POST\"])\r\nasync def dashboard():\r\n\t# Don't worry about authorization, the bot will handle it\r\n\tawait app_dashboard.process_request(request)\r\n \r\n \r\nif __name__ == \"__main__\":\r\n app.run()\r\n```\r\n\r\n\r\nPlease note that cogs are not currently supported.\r\n<br>\r\nYou will also need to use Quart as your webserver. Switching from another library isn't hard, so ask me and I'll gladly help you out.\r\n<br><br>\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A webhook and request based discord.py extension for making a bot dashboard.",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/timoo4devv/discord-ext-dash"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ffd7fb731cdd06c28a75fb04301d9fdfca122132fe984abc64305e087cc926e2",
"md5": "e8917da8592d4e589dca49d200d0cb2d",
"sha256": "5df7b67b4a927b9e1343cd11bdcebdf6626e0cc904921371fa88eb63f1bc873f"
},
"downloads": -1,
"filename": "discord_ext_dash-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e8917da8592d4e589dca49d200d0cb2d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5.3",
"size": 4535,
"upload_time": "2024-02-04T00:26:12",
"upload_time_iso_8601": "2024-02-04T00:26:12.788207Z",
"url": "https://files.pythonhosted.org/packages/ff/d7/fb731cdd06c28a75fb04301d9fdfca122132fe984abc64305e087cc926e2/discord_ext_dash-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1560c02ed0c6955b75cf1c80067dcfda1eae369ede48f1d7365b6c273676dd71",
"md5": "a35cc2e02e0ffd7d3ef070e8641bdecd",
"sha256": "438ac5f97d59aad1e1076a396173cc9169502a00e62d8137a61cc862450c7f18"
},
"downloads": -1,
"filename": "discord-ext-dash-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "a35cc2e02e0ffd7d3ef070e8641bdecd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5.3",
"size": 4006,
"upload_time": "2024-02-04T00:26:13",
"upload_time_iso_8601": "2024-02-04T00:26:13.763476Z",
"url": "https://files.pythonhosted.org/packages/15/60/c02ed0c6955b75cf1c80067dcfda1eae369ede48f1d7365b6c273676dd71/discord-ext-dash-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-04 00:26:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "timoo4devv",
"github_project": "discord-ext-dash",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "discord.py",
"specs": [
[
">=",
"1.5.1"
]
]
}
],
"lcname": "discord-ext-dash"
}