Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ButterBot

一个基于 Python 3.12+ 和 asyncio 的事件驱动机器人框架。项目把外部输入抽象为 Source,把数据与状态包装为 Event,再由 EventBus 分发给异步 Handler。

当前版本为 3.1.0b1 Beta。自定义 Source 和可信 Handler 插件已经开放真实环境 验证,但暂不承诺无人值守生产、跨 Beta 兼容或第三方 Source 自动发现。

当前仓库内置:

  • NapCat OneBot WebSocket 事件与 API;
  • Bilibili 动态轮询、直播状态轮询和直播弹幕事件源;
  • Source、API、Data、Type 和 Filter 扩展契约;
  • 统一启动、回调排空与资源关闭流程。

安装与开发

uv sync --locked --dev

已发布 wheel 的基础安装不包含 adapter 网络依赖. 按需安装 butterbot-python[napcat][bilibili][all]; NapCat 和 Bilibili extra 都显式包含 aiohttp.

运行完整 Python 检查:

uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run pyright

最小示例

不依赖外部服务的示例:

uv run examples/minimal_source_example.py

预期输出 ready 并正常退出。NapCat 与 Bilibili 示例需要先复制并填写本地配置:

cp examples/config.example.yaml config.yaml

config.yaml 可能包含凭证,已被 Git 忽略,不要提交或公开。

使用 CLI 创建、配置并运行项目:

uv run butterbot init
uv run butterbot plugin
uv run butterbot plugin check
uv run butterbot run --background
uv run butterbot status
uv run butterbot stop
uv run butterbot restart

run 默认加载 app.app 和当前目录的 config.yaml。可以用位置参数或 -path 指定其他应用入口,用 -config 指定其他 YAML:

uv run butterbot run mybot.application.app -config ./deploy/config.yaml
uv run butterbot run -path mybot.application.app -config ./deploy/config.yaml

应用入口只负责接收 CLI 已解析的配置并返回 BotApp,不要在模块导入时调用 app.run()

后台运行和重启语义见命令行指南

文档

本地启动 VuePress 2 + Plume 文档站:

npm install
npm run docs:dev

推荐入口:

生产构建与文档检查:

npm ci
npm run docs:build
npm run docs:lint
npm run docs:links

许可证

GPL-3.0

Download files

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

Source Distribution

butterbot_python-3.1.0b1.tar.gz (521.6 kB view details)

Uploaded Source

Built Distribution

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

butterbot_python-3.1.0b1-py3-none-any.whl (207.9 kB view details)

Uploaded Python 3

File details

Details for the file butterbot_python-3.1.0b1.tar.gz.

File metadata

  • Download URL: butterbot_python-3.1.0b1.tar.gz
  • Upload date:
  • Size: 521.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for butterbot_python-3.1.0b1.tar.gz
Algorithm Hash digest
SHA256 e02c8b27dd74e515f05bb0823f638954cec74c2b1d6954ba3b6b0ad1fe99726a
MD5 3e6bb4de2cef60b818606a77cb2d5fef
BLAKE2b-256 b55a86e5daf94a2ac0c20a0e1fc5cef5486a98296e704aa6da30baaa73d1b09d

See more details on using hashes here.

Provenance

The following attestation bundles were made for butterbot_python-3.1.0b1.tar.gz:

Publisher: release-on-version.yml on GEYUANwuqi/ButterBot

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

File details

Details for the file butterbot_python-3.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for butterbot_python-3.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 a42af1bc20554e5475d796b1408be1d893741fdea9b6a66f1fe7ea8578c67757
MD5 f59e031eb7d015926f39f4d09c02abdd
BLAKE2b-256 ff6bf9339be1fbf7b2fd39e3350ef402aa9cbf23e7ed78b094d4323a1031d383

See more details on using hashes here.

Provenance

The following attestation bundles were made for butterbot_python-3.1.0b1-py3-none-any.whl:

Publisher: release-on-version.yml on GEYUANwuqi/ButterBot

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

Release history Release notifications | RSS feed

3.1.1.post1

2 files

3.1.1

2 files

3.1.0

2 files

This release

3.1.0b1 This release

2 files

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