nanobot 的 QQ 频道插件,通过 NapCat / OneBot v11 接入聊天能力
Project description
nanobot-channel-anon
nanobot-channel-anon 是一个给 nanobot 使用的 QQ 频道插件,通过 NapCat 的 OneBot v11 接口接入 QQ,目标场景是 群聊 和 群管。
它可以把 QQ 私聊、群聊事件接入 nanobot,让机器人在群里陪聊、响应触发消息,并结合 MCP 工具完成一些常见群管操作。
功能
- 接入 NapCat OneBot v11 WebSocket
- 支持 QQ 私聊、群聊、poke 事件
- 支持群聊触发:关键词、@ 机器人、回复机器人、概率触发
- 支持上下文缓存,并把最近聊天整理成统一的 CTX 文本上下文后再交给 nanobot
- 支持图片、语音等常见消息处理
- 支持文本、图片、语音、视频、文件发送
- 附带 NapCat HTTP MCP 工具,可用于删消息、戳一戳、点赞、处理加群/加好友请求
安装
日常使用推荐直接安装已发布版本;如果你要跟进最新提交或参与开发,再使用源码方式。
uv 安装
推荐优先使用 uv,把 nanobot 主程序和本插件装到同一个 tool 环境里:
uv tool install nanobot-ai --with nanobot-channel-anon --with-executables-from nanobot-channel-anon
nanobot plugins list
pip 安装
如果你不用 uv,也可以在已经安装 nanobot-ai 的同一个 Python 环境里安装本插件:
pip install nanobot-ai nanobot-channel-anon
nanobot plugins list
正常情况下应能看到名为 Anon 的插件,频道名为 anon。
安装完成后,包还会提供一个 MCP server 启动命令:nanobot-anon-mcp。
源码开发安装
如果你是在本仓库内开发或调试,可继续使用源码方式:
git clone https://github.com/ByteColtX/nanobot-channel-anon.git
cd nanobot-channel-anon
uv sync --locked
uv run nanobot plugins list
快速开始
1. 初始化工作区
nanobot onboard
如果你是在源码仓库里直接运行,也可以使用:
uv run nanobot onboard
2. 在配置里启用本频道
在 nanobot 配置文件中补上本频道的最小配置,例如:
{
"channels": {
"anon": {
"enabled": true,
"wsUrl": "ws://127.0.0.1:3001",
"accessToken": "your_access_token",
"allowFrom": ["*"]
}
}
}
wsUrl:你的 NapCat WebSocket 地址allowFrom:允许接入的 QQ 号或群号
注意:
allowFrom=[]的语义是拒绝所有人。
3. 启动 nanobot
nanobot gateway --config /path/to/config.json
nanobot channels status -c /path/to/config.json
如果你是在源码仓库里直接运行,也可以继续使用:
uv run nanobot gateway --config /path/to/config.json
uv run nanobot channels status -c /path/to/config.json
MCP 群管工具
MCP 的安装、配置和使用说明见 nanobot_channel_anon/mcp/README.md。
开发
uv run ruff check .
uv run pyright
uv run pytest
uv build
注意事项
- 启用频道时,
wsUrl必填 allowFrom=[]表示拒绝所有来源- 语音转写依赖上游能力,必要时会使用
ffmpeg转码
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanobot_channel_anon-0.1.7.tar.gz.
File metadata
- Download URL: nanobot_channel_anon-0.1.7.tar.gz
- Upload date:
- Size: 274.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dfa3b64a7dbd6adc29a80e840f1b60249c7c9e0d8286b890d786530f9ced9cb
|
|
| MD5 |
e86948c3adec9309abb7c779115456cb
|
|
| BLAKE2b-256 |
b886ef82b212727faddfb95db6b4658f20acbed8687bd8cd528ebc90612c71de
|
Provenance
The following attestation bundles were made for nanobot_channel_anon-0.1.7.tar.gz:
Publisher:
publish.yml on ByteColtX/nanobot-channel-anon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobot_channel_anon-0.1.7.tar.gz -
Subject digest:
5dfa3b64a7dbd6adc29a80e840f1b60249c7c9e0d8286b890d786530f9ced9cb - Sigstore transparency entry: 1397414021
- Sigstore integration time:
-
Permalink:
ByteColtX/nanobot-channel-anon@daaf212ed85cf3e69afb46034ba066bc78e6d7cd -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/ByteColtX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@daaf212ed85cf3e69afb46034ba066bc78e6d7cd -
Trigger Event:
push
-
Statement type:
File details
Details for the file nanobot_channel_anon-0.1.7-py3-none-any.whl.
File metadata
- Download URL: nanobot_channel_anon-0.1.7-py3-none-any.whl
- Upload date:
- Size: 78.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc265dcf6d8a2898624ba7605a9f0002b3f2b1eaf13e774a0bb75cd12655d71
|
|
| MD5 |
b8b594b0cc2e21b3763eedf205762c2a
|
|
| BLAKE2b-256 |
71e576453fa3259291c45ad39a5d9e9495db76f394bc9acb7ec5b223b85901b0
|
Provenance
The following attestation bundles were made for nanobot_channel_anon-0.1.7-py3-none-any.whl:
Publisher:
publish.yml on ByteColtX/nanobot-channel-anon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobot_channel_anon-0.1.7-py3-none-any.whl -
Subject digest:
9dc265dcf6d8a2898624ba7605a9f0002b3f2b1eaf13e774a0bb75cd12655d71 - Sigstore transparency entry: 1397414038
- Sigstore integration time:
-
Permalink:
ByteColtX/nanobot-channel-anon@daaf212ed85cf3e69afb46034ba066bc78e6d7cd -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/ByteColtX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@daaf212ed85cf3e69afb46034ba066bc78e6d7cd -
Trigger Event:
push
-
Statement type: