A Telegram bot to manage Python scripts from chat: upload/edit, run/stop/restart, logs, env vars, autostart, version rollback, and basic monitoring.
Designed for single-owner usage (restricted by OWNER_ID).
- Scripts: upload
.pyas a file or paste as text, run/stop/restart, tail logs - ENV: global env + per-script env, optional env key detection from code
- Autostart: run selected scripts automatically when the manager starts
- Rollback: keeps last 10 versions per script with timestamps, one-click rollback
- Monitoring:
/monitoringshows CPU/MEM for running scripts (psutil)
Stored under DATA_DIR (default /data, mounted as a volume in Docker):
scripts/— current scripts (<name>.py)versions/<script_id>/— saved versions (<script_id>_<timestamp>.py)logs/— per-script logs (<script_id>.log)meta.json— scripts metadata (env/autostart/versions)requirements.txt— saved dependencies (from/pip ...)
BOT_TOKEN=123456:ABCDEF_your_token_here
OWNER_ID=123456789version: "3.8"
services:
pymanager:
build: .
container_name: pymanager
restart: unless-stopped
environment:
BOT_TOKEN: "${BOT_TOKEN}"
OWNER_ID: "${OWNER_ID}"
DATA_DIR: "/data"
volumes:
- ./data:/datadocker compose up -d --buildLogs:
docker compose logs -f pymanagerStop:
docker compose down/menu— interactive scripts menu (buttons)/new <name>— create script (send code as the next message)/run <id>— start script/stop <id>— stop script/logs <id>— show last log lines/monitoring— CPU/MEM for running scripts (install psutil if needed)/pip <args>— install packages and save intorequirements.txt
- Access is restricted to OWNER_ID.
- Dependencies installed via
/pipare persisted inrequirements.txtand installed on manager startup.
Apache-2.0 (see LICENSE)
