Skip to main content

PiBot

A discord bot providing administration and utility features!

Features

  • Easy to run (uses Python)
  • Modular cog-based architecture
  • MongoDB integration for per-guild feature settings (sparse storage — only non-default values)
  • DeepL translation support
  • AI channel summaries (Cloudflare)
  • Member activity stats (/userstats me, /userstats user)
  • Development tools for testing

Guild settings

Each feature cog owns its configuration. Administrators use slash commands under /<feature> settings:

Command Description
/<feature> settings view List all settings and current values
/<feature> settings set <setting> <value> Change one setting
/<feature> settings reset <setting> Restore one setting to its default

Features with settings today:

Feature Examples
general prefix, commandChannelId, countdownMaxSeconds
admin maxClearAmount, enabled
summarize Limits, model override, enabled
translations enabled
userstats enabled

Cloudflare and DeepL credentials are required at bot level via PIBOT_* environment variables (see Environment variables). Per-guild enabled flags toggle each feature on a server.

Settings are stored in MongoDB under features.<featureName>. Only values that differ from the model defaults are written.

To add settings for a new feature: subclass SettingsGroup in cogs/<feature>/config.py, mix in FeatureSettingsMixin on the cog, and set settingsGroup = YourConfig.

Installation

How to run a released build depends on where you want it to run.

As a Python package

Install from PyPI and run the pibot console script:

pip install pibot
# or: uv add pibot
pibot

As a container image

Each release publishes the same image to Docker Hub and to GitHub Container Registry (workflow).

Registry Image reference (example)
Docker Hub tobiasgoetz/pibot: docker run --env-file .env tobiasgoetz/pibot:latest
GHCR ghcr.io/tobiasgoetz/pibot:latest (and version tags; path uses a lowercased GitHub owner/repo) — e.g. docker run --env-file .env ghcr.io/tobiasgoetz/pibot:latest

To build an image from this repository locally, see Docker below.

On Kubernetes

Install the published Helm chart from GHCR OCI (workflow). Use an app version that matches pyproject.toml / the GitHub release:

helm install pibot oci://ghcr.io/tobiasgoetz/helm-charts/pibot --version <version>

Credentials come from an existing Secret (secretRef.name); non-secret options are under pibot: in the chart values file. Bundled Valkey is enabled by default (valkey.enabled=false for external). See charts/pibot/README.md.

Further release and command details: AGENTS.md.

Environment variables

Configure these for docker run, Helm (secretRef + pibot: values), or a .env file (see .env.example). All variables use the PIBOT_ prefix.

Naming: PIBOT_{NAME} for bootstrap/runtime; PIBOT_{FEATURE}_{VENDOR}_{FIELD} for feature integrations (e.g. PIBOT_SUMMARIZE_CLOUDFLARE_BASE_URL).

Variable Required Default Options Description
PIBOT_DISCORD_TOKEN Required — — Bot token from the Discord Developer Portal.
PIBOT_MONGODB_URI Required — Standard MongoDB URI (mongodb://…, mongodb+srv://…, etc.) Connection string for your MongoDB instance (local or Atlas).
PIBOT_VALKEY_URI Required* — Valkey URI (valkey://…, valkeys://…) Connection string for Valkey (guild settings cache). redis:// / rediss:// also work. *Not required in the Helm Secret when using the bundled Valkey subchart (default).
PIBOT_SUMMARIZE_CLOUDFLARE_BASE_URL Required — Cloudflare AI Gateway base URL (through /compat) Bot fails to start if unset.
PIBOT_SUMMARIZE_CLOUDFLARE_TOKEN Required — — Cloudflare AI Gateway token. Bot fails to start if unset.
PIBOT_TRANSLATIONS_DEEPL_API_KEY Required — — DeepL API key for flag-reaction translations. Bot fails to start if unset.
PIBOT_COMMAND_SYNC_BEHAVIOR Optional global global, local Startup slash-command sync. Invalid values fail at startup. Loaded via BotConfig in pibot/config.py.
PIBOT_ENABLE_DEV_TOOLS Optional false true, false (also 1 / 0) Load the DevTools cog when true. Unset → false. Loaded via BotConfig in pibot/config.py.
PIBOT_LOG_LEVEL Optional INFO DEBUG, INFO, WARNING, ERROR, CRITICAL Logging level for the pibot logger hierarchy. Third-party libraries stay at INFO. Unknown values fall back to INFO.

Local development

Prerequisites

  • Python 3.14 or higher
  • uv package manager
  • MongoDB instance (local or remote)
  • Valkey (local Compose service, or remote) — see below
  • Discord bot token from Discord Developer Portal
  • Docker (optional, for the local Valkey Compose service)

Setup

  1. Clone the repository

    git clone https://github.com/TobiasGoetz/pibot.git
    cd pibot
    
  2. Install dependencies

    uv sync
    
  3. Set up environment variables

    Copy the example environment file and create your .env file with your values:

    cp .env.example .env
    

    Edit .env with your actual values. See Environment variables for the full list.

  4. Start local Valkey (if using PIBOT_VALKEY_URI=valkey://localhost:6379/0 from .env.example)

    docker compose up -d valkey
    
  5. Run the bot

    uv run pibot
    

Behaviour in development

Defaults are PIBOT_COMMAND_SYNC_BEHAVIOR=global and PIBOT_ENABLE_DEV_TOOLS=false. For local development without global sync at startup, set PIBOT_COMMAND_SYNC_BEHAVIOR=local; enable DevTools with PIBOT_ENABLE_DEV_TOOLS=true and use DevTools sync for guild-scoped command testing. See AGENTS.md.

Linting, types, docs, and releases

See AGENTS.md for Ruff/ty commands, Sphinx doc regeneration, Docker/Helm/PyPI flows, and Release Please.

Docker (local builds)

To build and run the image on your machine (no registry push):

docker build -t pibot:local .
docker run --env-file .env pibot:local

For day-to-day development, uv run pibot is usually faster than rebuilding images.

Metadata

Release files for pibot-discord 4.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pibot-discord 4.1.1
File Size Uploaded Provenance Actions
pibot_discord-4.1.1.tar.gz 29.5 kB Without provenance Details for pibot_discord-4.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pibot-discord 4.1.1
File Interpreter ABI Platform Actions
pibot_discord-4.1.1-py3-none-any.whl Python 3 none any Details for pibot_discord-4.1.1-py3-none-any.whl

Total release size: 72.9 kB

Release files / pibot_discord-4.1.1.tar.gz

Download URL pibot_discord-4.1.1.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4dcc6932a730f6e1c2290746da92b01047d088dae537b82575da52fb00fc0922
BLAKE2b-256 checksum
How to use checksums
d5308ecb68a124e3879733fb89fb38b33e616036555a6519fa139d0c301673ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pibot_discord-4.1.1-py3-none-any.whl

Download URL pibot_discord-4.1.1-py3-none-any.whl
Size 43.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d874709c1ea0fc0fcf925630b350813255d80debb880b4c59d5bf3160300400
BLAKE2b-256 checksum
How to use checksums
1a729e5b017fdc9a96e5e2c63875415d1582e177e5fa143f361e3f07ba0bef78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pibot-discord 4.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page