butterrobot/README.md
Felipe M. a2e1196953
Some checks failed
CI / goreleaser-lint (push) Successful in 6s
CI / format (push) Successful in 57s
CI / test (push) Successful in 2m59s
CI / lint (push) Successful in 4m9s
CI / build (push) Successful in 7m17s
Release / release (push) Failing after 7m6s
feat: add Sentry observability support
Report errors, panics and optional performance traces to Sentry. Sentry
stays disabled unless SENTRY_DSN is set.

- slog ERROR records become Sentry issues, with the error attribute
  promoted to an exception so issues group by root cause
- queue worker, reminder worker, cache cleanup and HTTP handler panics
  are captured with a stack trace
- events carry platform/plugin/component tags for filtering
- HTTP requests are traced when SENTRY_TRACES_SAMPLE_RATE is above 0;
  /healthz is never traced

Configured credentials are redacted from every outgoing payload. This is
required rather than defensive: the Telegram webhook embeds the bot token
in its URL path, and failed Telegram API calls quote that URL in their
error text, so events would otherwise carry the token in the clear. A new
platform must register its credential in Config.Secrets().

Also moves the module to Go 1.27, refreshes every dependency and pins
golangci-lint v2.13.2. sentry-go 0.48 removed issue creation from its slog
integration, so the ERROR-to-issue conversion lives in
internal/observability/handler.go instead of relying on the SDK; leaving
it to the SDK would have silently downgraded issues to log lines.

Claude-Session: https://claude.ai/code/session_01W7tcpMTEyk9RrHvT7Be5zZ
2026-09-21 14:10:15 +02:00

2.5 KiB

Butter Robot

Status badge

Go framework to create bots for several platforms.

Butter Robot

What is my purpose?

Features

  • Support for chat platforms (Telegram)
  • Plugin system for easy extension
  • Admin interface for managing channels and plugins
  • Message queue for asynchronous processing
  • Optional Sentry error reporting and tracing

Documentation

Go to documentation

Database Management

ButterRobot includes an automatic database migration system. Migrations are applied automatically when the application starts, ensuring your database schema is always up to date.

Learn more about migrations

Installation

From Source

# Clone the repository
git clone https://git.nakama.town/fmartingr/butterrobot.git
cd butterrobot

# Build the application
go build -o butterrobot ./cmd/butterrobot

Containers

The fmartingr/butterrobot/butterrobot container image is published on Github packages:

docker pull docker.pkg.git.nakama.town/fmartingr/butterrobot/butterrobot:latest
docker run -d --name butterrobot -p 8080:8080 docker.pkg.git.nakama.town/fmartingr/butterrobot/butterrobot:latest

Configuration

Configuration is done through environment variables:

  • DEBUG: Set to "y" to enable debug mode
  • BUTTERROBOT_HOSTNAME: Hostname for webhook URLs
  • LOG_LEVEL: Logging level (DEBUG, INFO, WARN, ERROR)
  • SECRET_KEY: Secret key for sessions and password hashing
  • DATABASE_PATH: Path to SQLite database file

Observability

Sentry error reporting is optional and off until a DSN is provided:

  • SENTRY_DSN: Sentry DSN (empty disables reporting)
  • SENTRY_ENVIRONMENT: Environment name (default production)
  • SENTRY_RELEASE: Release identifier (defaults to the build version)
  • SENTRY_TRACES_SAMPLE_RATE: Fraction of HTTP requests traced, 0.0-1.0 (default 0)
  • SENTRY_ENABLE_LOGS: Set to y to forward non-error logs to Sentry

Learn more about observability

Platform-specific configuration

Telegram

  • TELEGRAM_TOKEN: Telegram bot token

Contributing

git clone git@github.com:fmartingr/butterrobot.git
cd butterrobot
go mod download

Create a .env-local file with the required environment variables:

TELEGRAM_TOKEN=xxx
...

And then you can run it directly:

go run ./cmd/butterrobot/main.go

License

GPL-2.0