Skip to main content

Multi-platform SRE ChatOps bot (Telegram / Discord / Slack)

Project description

bot-cmder

CI

Multi-platform SRE ChatOps bot — drive maintenance operations from Telegram, Discord, and Slack when you're away from your laptop and prod has issues. Same dispatcher, same /cmd UX, same JSONL audit log on every platform; per-message TOTP gate on PRIVILEGED operations so a leaked chat session can't restart your services.

Why bot-cmder

  • Operate prod from your phone. SSH-driven service actions, kubectl, custom runbooks — all reachable through chat. No laptop required during incidents.
  • Strong defaults you can live with. TOTP-gated PRIVILEGED commands, append-only JSONL audit log with built-in rotation, per-host SSH command allowlists, ACL-driven access. Safe out of the box.
  • One codebase, three platforms. Telegram + Discord + Slack adapters share the dispatcher / OTP gate / audit log. Pick one, all three, or none — every adapter mounts on demand.

Quick start

pip install bot-cmder
bot-cmder init                              # scaffold ~/.config/bot-cmder/{app.yaml,.env} + state dir
bot-cmder configure                         # interactive wizard — fill Telegram/Discord/Slack credentials
# edit ~/.config/bot-cmder/app.yaml — add your users + ACL
bot-cmder enroll-totp --user telegram:<your-id>
bot-cmder serve

→ For the full 30-minute walkthrough from pip install to "I just ran a privileged command via TOTP", see docs/getting-started.md.

Other install paths (source / Docker) below.

Install

From PyPI (recommended)

pip install bot-cmder

Lands bot-cmder on your PATH; pairs with python -m bot_cmder (equivalent).

From source (contributors)

Requires uv.

git clone https://github.com/zondatw/bot-cmder.git
cd bot-cmder
uv sync && pre-commit install --install-hooks
uv run bot-cmder init --config-dir .       # scaffolds into repo (./config/, ./var/) instead of ~/.config
uv run bot-cmder serve --reload

The from-source flow uses ./config/app.yaml, ./.env, and ./var/ (CWD-relative), preserving the dev workflow exactly.

Via Docker / GHCR

docker pull ghcr.io/zondatw/bot-cmder:latest

docker run --rm -it -v bot-cmder-cfg:/etc/bot-cmder \
  ghcr.io/zondatw/bot-cmder:latest init --config-dir /etc/bot-cmder

docker run -d --name bot-cmder \
  -v bot-cmder-cfg:/etc/bot-cmder:ro \
  -v bot-cmder-state:/var/lib/bot-cmder \
  -p 47823:47823 \
  --restart unless-stopped \
  ghcr.io/zondatw/bot-cmder:latest

Multi-arch (amd64 + arm64). Full walkthrough including k8s + Compose examples in docs/docker.md.

Config file locations

bot-cmder searches for app.yaml (and .env, and the state dir) in this order, returning the first hit:

  1. --config <path> CLI flag / BOT_CMDER_CONFIG env var
  2. ./config/app.yaml (CWD-relative, dev workflow)
  3. $XDG_CONFIG_HOME/bot-cmder/app.yaml (default ~/.config/bot-cmder/app.yaml, installed flow)

Same precedence for .env (./.env$XDG_CONFIG_HOME/bot-cmder/.env) and the state dir (BOT_CMDER_STATE_DIR./var/$XDG_STATE_HOME/bot-cmder/).

The legacy BIND_HOST / BIND_PORT / RELOAD / APP_CONFIG_PATH env names keep working through 0.2.x with a deprecation warning; rename to the BOT_CMDER_* form before 0.3.0.

Documentation

Getting started 30-minute walkthrough — from pip install to your first PRIVILEGED command
Full config reference Every settable field with default + comment
CHANGELOG Per-release notes (Keep a Changelog format)
Discord setup docs/discord-setup.md — app + slash commands
Slack setup docs/slack-setup.md — manifest + signing secret
Telegram polling (no domain) docs/telegram-polling.md
Slack Socket Mode (no domain) docs/slack-socket-mode.md
Discord Gateway (no domain) docs/discord-gateway.md
TOTP + emergency mode docs/otp.md
Audit log rotation docs/audit-rotation.md
Docker / GHCR docs/docker.md
Maintainer release procedure docs/release.md
Contributor workflow AGENTS.md — issue-first, atomic commits, PR-then-merge
Personal-ID leak prevention docs/git-leak-prevention.md

Architecture (one paragraph)

bot_cmder/ package layout: adapters/ (how chat platforms talk to the bot — Telegram, Discord, Slack, with both push and outbound-pull modes per platform); core/ (registry, dispatcher, parser, ACL, OTP gate); connectors/ (how the bot talks to infra — local subprocess, SSH); auth/ (TOTP enrollment, secret store, pending sessions, emergency-bypass windows); audit/ (JSONL writer with rotation); config/ (pydantic schema + XDG-aware path resolution); commands/ (built-in /help / /whoami / /health / /kubectl / /runbook / /service / /ssh / /otp); cli/ (the bot-cmder shell command). Tests mirror the package layout under tests/.

Run tests

uv run pytest -q
uv run pre-commit run --all-files

Changelog

Per-release notes — what's added / changed / deprecated / removed — in CHANGELOG.md. Format: Keep a Changelog 1.1.0.

License

MIT — see LICENSE.

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_cmder-0.3.0.tar.gz (368.1 kB view details)

Uploaded Source

Built Distribution

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

bot_cmder-0.3.0-py3-none-any.whl (157.3 kB view details)

Uploaded Python 3

File details

Details for the file bot_cmder-0.3.0.tar.gz.

File metadata

  • Download URL: bot_cmder-0.3.0.tar.gz
  • Upload date:
  • Size: 368.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bot_cmder-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a4b7724fc83c03d52744f940e22b9c8b3590a30fde98e803969e486e9ee0af2c
MD5 f56caec4f29a3ae9770ffb2ed5481c17
BLAKE2b-256 7a784d3a320303aaf3b4fa93e513fd5ab3bbdf6d32408f28027458ebc3c18370

See more details on using hashes here.

Provenance

The following attestation bundles were made for bot_cmder-0.3.0.tar.gz:

Publisher: release.yml on zondatw/bot-cmder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bot_cmder-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: bot_cmder-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 157.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bot_cmder-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc2fe95a48289e3c8f350aa942e7d5bc6a990da41bf91ad9087981708db3b09b
MD5 b677bb24795222c4d935aad2b5181256
BLAKE2b-256 bab9eeaf36001c27ce8dd837f1c2634dd51483c8ebfdf337cd03ab2dec191247

See more details on using hashes here.

Provenance

The following attestation bundles were made for bot_cmder-0.3.0-py3-none-any.whl:

Publisher: release.yml on zondatw/bot-cmder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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