Skip to main content

Process manager for Telegram bots with auto-restart, persistent logging, and a Textual TUI

Project description

Bot Master

A process manager for Telegram bots with a terminal UI. Runs as a background daemon (survives reboots via systemd) with a Textual TUI client for monitoring.

Architecture

  • Daemon (bot-master-daemon) — manages bot subprocesses, auto-restarts on crash (exponential backoff), buffers logs in memory and writes to disk. Communicates via Unix socket.
  • TUI Client (bot-master) — connects to the daemon to view live status, stream logs, and send start/stop/restart commands. If the TUI crashes, bots keep running.

Quick Start

Install with uvx

uvx bot-master install

This interactive wizard will:

  1. Ask where to store config and logs (default: ~/bots/bot-master)
  2. Create a bots.yaml template
  3. Generate a systemd service file

Then follow the printed next steps to finish setup.

Connect to the dashboard

uvx bot-master

If the daemon isn't running, it will tell you how to start it.

Installation (alternative methods)

Install permanently with uv

uv tool install bot-master

Then use bot-master and bot-master-daemon directly (no uvx needed).

From source

cd ~/bots/bot-master
uv sync
uv run bot-master-daemon          # start daemon
uv run bot-master                  # connect TUI

Configuration

Edit bots.yaml:

bots:
  my-bot:
    directory: /path/to/bot
    command: uv run python main.py

  another-bot:
    directory: /path/to/another-bot
    command: uv run python main.py

systemd Service

The install wizard generates a service file. To install it manually:

sudo cp ~/bots/bot-master/bot-master.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now bot-master

This ensures the daemon starts on boot and auto-restarts on failure.

Manual daemon start (without systemd)

bot-master-daemon [path/to/bots.yaml]

TUI Keybindings

Key Action
s Start selected bot
x Stop selected bot
r Restart selected bot
a Start all bots
z Stop all bots
j/k or arrows Navigate bot list
q Quit TUI (daemon keeps running)

Logs

Logs are stored in the logs/ directory (one file per bot, 10 MB rotation with 5 backups):

logs/
  au-tomator.log
  zapier.log
  writing-assistant.log

The daemon also keeps the last 5000 lines per bot in memory for fast streaming to the TUI.

Environment Variables

Variable Default Description
BOT_MASTER_SOCK /tmp/bot-master.sock Unix socket path
BOT_MASTER_CONFIG bots.yaml Config file path
BOT_MASTER_LOG_DIR logs Log directory path

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bot_master-0.2.0.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bot_master-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file bot_master-0.2.0.tar.gz.

File metadata

  • Download URL: bot_master-0.2.0.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for bot_master-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7287d5c7f6fd155378387f590c3889f30c7df954243317d9fa0e71bbe051aa1a
MD5 11a146a4e0b631f74e2d5aff03fe78b1
BLAKE2b-256 738a423723e2bb7c00f35de261bfa80f6f940326c9fb2e24b0774f289a63ac27

See more details on using hashes here.

File details

Details for the file bot_master-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bot_master-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for bot_master-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3340a5e4bf971e723b095e6cc52f4a0b35630ee7abc3a67f5d0bdab4027b802
MD5 864ce1f62d60732e62243a3ca16213b1
BLAKE2b-256 d7be2fe62aad5949af16dbb036a483f8da838c0a7f4a0aa8967083af21bd1296

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page