A robust, modular Discord bot designed to oversee, update, and monitor multiple independent Discord bots on a Windows machine. It runs silently in the background and provides a centralized command center for all your bots.
- Silent Background Execution: Child bots are launched with hidden console windows (ideal for Task Scheduler).
- Process Monitoring: Real-time status tracking and resource usage (CPU, RAM, Uptime).
- Automated Updates: Integrated Git pull and pip dependency installation.
- Self-Management: The manager can update and restart itself via Discord commands.
- Crash Alerts: Real-time notifications if a managed bot stops unexpectedly.
- Audit Logging: Rotating log system with a detailed command history (who used which command).
- Resource Monitoring: Track CPU (%), RAM (MB), and Uptime for every managed bot via
/status. - Git Rollback: Quickly revert to the previous Git state (
HEAD@{1}) if an update breaks anything. - Log Access: Remote retrieval of bot log files directly through Discord.
-
Clone the repository:
git clone <repo-url> cd discord_bot_manager
-
Install dependencies:
pip install -r requirements.txt
-
Configuration:
- Create a
.envfile with yourDISCORD_TOKEN,GUILD_ID, andADMIN_CHANNEL_ID. - Edit
config.jsonto map your Bot IDs to their local paths and start commands.
- Create a
-
Run the Manager:
python manager.py
/status: View all bots' status and resource usage./update <bot_name>: Git pull + pip install + restart./restart <bot_name>: Immediate restart without updating./rollback <bot_name>: Revert to the version before the last update./logs <bot_name> [lines]: Fetch the last N lines of logs (default: 50).
manager.py: Core logic and background process monitor.cogs/: Command modules (Admin & Monitoring).core/: Shared utilities and decorators.config.json: Persistent configuration for managed bots.