An open-source Discord bot
This project now includes:
- Discord Gateway bot runtime (Python)
- Flask API server (Python)
- SQLite storage (
manubot.db) - React + Vite frontend dashboard (
src/frontend/)
src/main.py: startup/orchestration (loads env, starts Flask thread, runs Discord loop)src/discord.py: Discord Gateway connection, heartbeat, reconnect loopsrc/webback.py: Flask app factory and API/static routessrc/database.py: SQLite schema setup and event read/write helperssrc/frontend/: React + Vite dashboard app
pip install -r requirements.txtRun backend (Discord bot + Flask API):
python src/main.pyIn another terminal run frontend dev server:
cd src/frontend
npm install
npm run devOpen: http://localhost:5173
Build frontend once:
cd src/frontend
npm install
npm run buildThen run backend:
python src/main.pyFlask will serve the built React app from src/frontend/dist
http://localhost:6540/(dashboard)
Build a production image (frontend is built inside Docker):
docker build -t manubot:latest .Run the image with your .env:
docker run --rm -p 6540:6540 --env-file .env manubot:latestOpen: http://localhost:6540
Compose uses:
.envfor secrets/config (TOKEN,APP_ID, optionalAPI_PORT)./databind mount for persistent SQLite file at/data/manubot.db
Start:
docker compose up --build -dLogs:
docker compose logs -fStop:
docker compose downUse your .env file:
TOKEN=your_discord_bot_token
APP_ID=your_discord_application_id
API_PORT=6540
DB_PATH=src/manubot.db
SUPERADMIN_USERNAME=superadmin
SUPERADMIN_PASSWORD=change_me_now
# Optional: bcrypt hash version of superadmin password.
# If set, this takes priority over SUPERADMIN_PASSWORD.
# SUPERADMIN_PASSWORD_HASH=$2b$12$...DB_PATH is optional for local non-Docker runs.
TOKEN and SUPERADMIN_USERNAME are required to run the server.
For superadmin login itself, set either SUPERADMIN_PASSWORD or SUPERADMIN_PASSWORD_HASH.
- Do not copy
.envinto the image. - Keep
.envon host and pass it at runtime:docker run --env-file .env ...- or
env_file: .envin Compose (already configured indocker-compose.yml)
- If you use Compose and also set values in
environment:, those explicitenvironmentvalues win overenv_filevalues for same keys.
Frontend UI version is now generated from src/frontend/package.json during Vite build, so there are no hardcoded v0.0.x strings to update in React files.
From src/frontend/:
# Increment version locally (no git tag created by npm)
npm run version:patch
npm run version:minor
npm run version:majorOr sync directly from a git tag:
# Use latest git tag (example: v0.0.3)
npm run version:sync-tag
# Or pass explicit tag
npm run version:sync-tag -- v0.0.3