Initialize a production-ready Discord.py bot in just 4 lines of code. Smart and automated command syncing, easy-to-use in-Discord dashboard, logging backend, and more. Made by likerofturtles
Project description
Dopamine Framework
Dopamine Framework is the best framework for discord.py bots. Dopamine Framework allows you to initialize a production-ready Discord bot in just 4 lines of code. It is designed to streamline the development of scalable Discord applications by automating the process of registering commands, diagnosing the bot, and various other utilities such as a paginator helper and "Private View" helpers which let only the user who initiated the interaction to interact with the components like buttons.
Made by likerofturtles.
Installing
Use Python 3.12 or higher:
# Linux/MacOS
python3 -m pip install -U dopamine-framework
# Windows
py -3 -m pip install -U dopamine-framework
Features
1. Smart Command Syncs
The framework includes a Command Registry that compares local command states with remote Discord API states. This ensures that global and guild-specific slash commands are only synced when changes are detected, preventing unnecessary API overhead and rate-limit triggers.
2. Diagnostics
The built-in Diagnostics "cog" (module) provides real-time monitoring of the bot's health, including:
- Latency: High precision API, Heartbeat, and Round-trip latency monitoring.
- Resource Utilization: CPU and RAM usage tracking via
psutil. - Graphs: Generate graphs for the bot's latency for visual performance auditing.
- Host Device Metrics: Integration with system sensors to report host location and battery status, if available.
3. In-Discord Owner Dashboard
Never have to need terminal access/SSH using this simple to use and feature-rich dashboard for bot owners, accessed using /od. This allows bot owner(s) to manage, diagnose the bot right within Discord itself. This dashboard allows the bot to run idefinitely without restarts:
- Cog Management: Dynamic loading, unloading, and reloading of cogs.
- Power State: Remote shutdown and process-level restarts.
- Logs: Real-time retrieval of local log files via the Discord UI.
- Manual Command Syncs: Sync commands manually globally or within only the current guild.
4. Built-in Logging Backend
- A robust Logging Manager utilizing
aiosqlitethat can be plugged into any feature of your bot to implement a logging system, such as for mod logs, action logs, etc.
Implementation Example
To initialize a bot using the Dopamine Framework, follow the following example:
import discord
from dopamine_framework import Bot
bot = Bot(command_prefix="?", cogs_path="modules", logging_path="logging.db", default_diagnostics=True, intents=discord.Intents.default()) # If no cogs folder is defined, it will default to "cogs". If no logging path, logging will be disabled.
bot.run("YOUR_BOT_TOKEN_HERE")
Requirements
discord.pyaiosqlitepsutilPillowgeocoder
Logging Manager Documentation
The LoggingManager is an asynchronous backend designed to facilitate per-guild Discord channel logging for things such as mod logs, action logs, and more.
self.logger.get(guild.id): Get the logging channel, where guild.id the guild whose logging channel's ID you want to get.self.logger.set(guild.id, channel_id): Set the logging channel, where guild.id the guild and channel_id is the ID of the channel to be set for logging.self.logger.delete(guild.id): Delete the logging channel, where guild.id the guild whose logging channel you want to delete.
Example:
import discord
from dopamine_framework import Bot
bot = Bot(command_prefix="?", cogs_path="modules", logging_path="logging.db", default_diagnostics=True, intents=discord.Intents.default()) # Define logging path to enable logging. If no logging path, logging will be disabled.
bot.run("YOUR_BOT_TOKEN_HERE")
License & Attribution
Dopamine Framework is licensed under the Apache License 2.0.
How to Credit
While you are free to use this framework for private or commercial bots, I require explicit credit. Please include a link to this repository or a mention of "Dopamine Framework" in:
- Your project's README or documentation.
- Your bot's info/credits command (for example
/aboutor/help).
Example: "Built with Dopamine Framework"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 dopamine_framework-1.0.4.tar.gz.
File metadata
- Download URL: dopamine_framework-1.0.4.tar.gz
- Upload date:
- Size: 165.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cb08fdb5142c531f25fc4199a5079ef2ae89f8f931983f5589d1c0153297d70
|
|
| MD5 |
b4ce6f0913628a1fe5883fc605f46d6f
|
|
| BLAKE2b-256 |
bcb836a783248b6f6d1b9fcd5a99473ca1630f26a8b4949647931094bb415060
|
Provenance
The following attestation bundles were made for dopamine_framework-1.0.4.tar.gz:
Publisher:
publish.yml on likerofturtles/dopamine-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dopamine_framework-1.0.4.tar.gz -
Subject digest:
5cb08fdb5142c531f25fc4199a5079ef2ae89f8f931983f5589d1c0153297d70 - Sigstore transparency entry: 936596785
- Sigstore integration time:
-
Permalink:
likerofturtles/dopamine-framework@886c92b4cb89e30c8e1d605f222a7dbd8e6032a3 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/likerofturtles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@886c92b4cb89e30c8e1d605f222a7dbd8e6032a3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dopamine_framework-1.0.4-py3-none-any.whl.
File metadata
- Download URL: dopamine_framework-1.0.4-py3-none-any.whl
- Upload date:
- Size: 167.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa6713d5db0ca22b1695950eeea0a04397ac403305b10ce192dfde3a3caeb8b4
|
|
| MD5 |
575ea8c8eb17c2367bc6fbfff4b3e73e
|
|
| BLAKE2b-256 |
b66c24a80efaedf318c9e578e86fee3d54e360adbbc3c1edc5ba3837fed40ccd
|
Provenance
The following attestation bundles were made for dopamine_framework-1.0.4-py3-none-any.whl:
Publisher:
publish.yml on likerofturtles/dopamine-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dopamine_framework-1.0.4-py3-none-any.whl -
Subject digest:
fa6713d5db0ca22b1695950eeea0a04397ac403305b10ce192dfde3a3caeb8b4 - Sigstore transparency entry: 936596789
- Sigstore integration time:
-
Permalink:
likerofturtles/dopamine-framework@886c92b4cb89e30c8e1d605f222a7dbd8e6032a3 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/likerofturtles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@886c92b4cb89e30c8e1d605f222a7dbd8e6032a3 -
Trigger Event:
release
-
Statement type: