Refactor main.py to implement Flask app, SQLAlchemy models for Bot and BotLog, and health check functionality. Update pyproject.toml with new dependencies and add new HTML templates for the user interface. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e72fc1b7-94bd-4d6c-801f-cbac2fae245c Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 5f598d52-420e-4e2c-88ea-a4c3e41fdcb6 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/e72fc1b7-94bd-4d6c-801f-cbac2fae245c/jW8PJKQ Replit-Helium-Checkpoint-Created: true
3.1 KiB
3.1 KiB
Bot Master
A centralized management dashboard for managing multiple Discord bots.
Overview
Bot Master is a Flask-based web application that provides a central dashboard for monitoring and managing multiple Discord bots. It supports:
- Bot Registry: Store configurations for all your bots
- Status Monitoring: Real-time health checks for each bot
- Statistics: Track servers, commands, and uptime across all bots
- CRUD Operations: Add, edit, view, and delete bot configurations
Tech Stack
- Backend: Python/Flask
- Database: PostgreSQL (via Flask-SQLAlchemy)
- Frontend: Jinja2 templates with custom CSS
Project Structure
/
├── main.py # Flask application entry point
├── templates/ # HTML templates
│ ├── base.html # Base layout template
│ ├── dashboard.html # Main dashboard view
│ ├── bots.html # Bot list table view
│ ├── add_bot.html # Add new bot form
│ ├── view_bot.html # Bot details view
│ └── edit_bot.html # Edit bot form
├── static/ # Static assets (currently empty)
└── attached_assets/ # Uploaded files and extracted bot examples
├── bot1/ # Example AeThex bot (basic)
└── bot2/ # Example AeThex bot (extended with feed sync)
Database Models
Bot
id: Primary keyname: Bot name (required)description: Bot descriptionhealth_endpoint: URL for health check APIadmin_token: Bearer token for authenticated endpointsbot_type: Type of bot (discord, telegram, slack, other)status: Current status (online, offline, unknown, timeout, error)last_checked: Timestamp of last health checkguild_count,command_count,uptime_seconds: Stats from health endpointcreated_at,updated_at: Timestamps
BotLog
- Stores log entries per bot (for future logging features)
API Endpoints
GET /- DashboardGET /bots- List all botsGET /bots/add- Add bot formPOST /bots/add- Create new botGET /bots/<id>- View bot detailsGET /bots/<id>/edit- Edit bot formPOST /bots/<id>/edit- Update botPOST /bots/<id>/delete- Delete botPOST /bots/<id>/check- Check bot health
API (JSON)
GET /api/bots- List all bots as JSONGET /api/bots/<id>/health- Check specific bot healthPOST /api/check-all- Check all bots health
Health Check Integration
Each bot should expose a health endpoint that returns JSON:
{
"status": "online",
"guilds": 5,
"commands": 12,
"uptime": 3600
}
Running the Application
The application runs on port 5000 using the Flask development server.
Environment Variables
DATABASE_URL- PostgreSQL connection stringFLASK_SECRET_KEY- Secret key for session management (auto-generated if not set)
Example Bots
The attached_assets folder contains two example AeThex Discord bots:
- Bot 1: Basic version with verify, profile, set-realm, unlink, verify-role commands
- Bot 2: Extended version with additional help, stats, leaderboard, post commands and feed sync