# AstrBot PaperPhone Plus 适配器插件 使 [AstrBot](https://github.com/AstrBotDevs/AstrBot) 能以普通用户身份接入 [PaperPhone Plus](https://github.com/619dev/Paperphone-plus) 即时通讯平台(Rust 后端版本)。 > ⚠️ **重要限制:本插件仅支持群聊会话。** > PaperPhone Plus 的私聊消息采用端对端加密(E2EE),Bot 无法可靠解密私聊消息内容。当用户发送私聊消息时,Bot 会自动忽略。 ## ✨ 功能 - 👥 **群聊消息收发** — 接收和回复群组消息 - 🖼️ **图片收发** — 支持图片上传和接收(通过 R2/本地存储) - 🔄 **自动重连** — WebSocket 断线自动重连 - 📝 **自动注册** — 可选自动注册 Bot 账户 - 🚫 **私聊自动忽略** — 收到私聊消息时自动跳过 ## ⚠️ 关于私聊限制 PaperPhone Plus 的私聊消息采用无状态 ECDH + XSalsa20-Poly1305 逐消息加密协议。Bot 每次启动时会重新生成加密密钥,而发送方可能使用了 Bot 旧的公钥进行加密,导致 Bot 无法解密已有的私聊消息。因此: - ❌ Bot 不处理私聊消息 - ✅ Bot 仅处理群聊消息(群聊消息不加密) ## 📦 安装 ### 方式一:AstrBot WebUI 安装 在 AstrBot 管理面板的插件市场中搜索 `paperphoneplus`,一键安装。 ### 方式二:手动安装 ```bash cd AstrBot/data/plugins git clone https://github.com/619dev/astrbot_plugin_paperphoneplus ``` ## ⚙️ 配置 在 AstrBot WebUI 中添加 PaperPhone Plus 平台适配器,填写以下配置: | 配置项 | 说明 | 示例 | |--------|------|------| | `server_url` | PaperPhone Plus 服务器地址 | `http://localhost:3000` | | `username` | Bot 用户名 | `my_bot` | | `password` | Bot 密码 | `secure_password` | | `auto_register` | 登录失败时自动注册 | `true` | | `bot_nickname` | 自动注册时使用的昵称 | `AstrBot` | ## 🚀 使用方法 1. 部署 PaperPhone Plus 服务器(参考 [PaperPhone Plus 文档](https://github.com/619dev/Paperphone-plus)) 2. 注册 Bot 账户(二选一): - 在 PaperPhone Plus 客户端手动注册一个账户 - 或设置 `auto_register: true`,插件会自动注册 3. 在 AstrBot 中配置: ```yaml server_url: "https://your-paperphone-plus-server.com" username: "my_bot" password: "secure_password" auto_register: true bot_nickname: "我的助手" ``` 4. 启动 AstrBot,插件会自动连接到 PaperPhone Plus 5. 在 PaperPhone Plus 客户端中: - 将 Bot 添加到群聊中 - 在群聊中 @Bot 或发消息即可开始对话 ## 🏗️ 架构 ``` PaperPhone Plus 用户 ←→ PaperPhone Plus Server (Rust/Axum) ←→ [WebSocket] ←→ AstrBot Plugin ←→ AstrBot Core ↑ 仅处理群聊消息(明文) ``` ## 📋 与 PaperPhone 原版适配器的区别 | 特性 | PaperPhone 原版 | PaperPhone Plus | |------|-----------------|-----------------| | 后端 | Node.js | Rust (Axum 0.8) | | 数据库 | SQLite | MySQL 8.0 + Redis 7 | | 密码哈希 | bcrypt | Argon2 (服务端处理) | | 文件存储 | 本地 | Cloudflare R2 + 本地回退 | | 密钥字段 | ik_pub, spk_pub, spk_sig | ik_pub, spk_pub, spk_sig, **kem_pub** | | 2FA | 不支持 | TOTP 两步验证 | | 会话管理 | 无 | 多设备会话管理 | ## 📦 依赖 - `aiohttp` — 异步 HTTP 和 WebSocket 客户端 ## 📄 许可 AGPL-3.0