Files
loveuer 31624a2a50 docs: align guides with the slimmed fork
Refresh setup, Docker, release, and contribution guidance.
Fix channel settings examples and credential documentation.
Remove Antigravity tutorials and redirect outdated translations.
Align platform, model routing, and troubleshooting instructions.
2026-11-17 16:00:25 +08:00

1.4 KiB

返回 README

OneBot

OneBot 是一个面向 QQ 机器人的开放协议标准,为多种 QQ 机器人实现(例如 go-cqhttp、Mirai)提供了统一的接口。它使用 WebSocket 进行通信。

配置

配置结构:enabled、type、allow_from 等公共字段位于渠道条目,Token、App ID 等专有字段位于 settings。.security.yml 使用 channel_list.<名称>.settings 保存渠道密钥;其中的同名值会覆盖主配置。

{
  "channel_list": {
    "onebot": {
      "enabled": true,
      "type": "onebot",
      "allow_from": [],
      "settings": {
        "ws_url": "ws://localhost:8080",
        "access_token": ""
      }
    }
  }
}
字段 类型 必填 描述
enabled bool 是 是否启用 OneBot 频道
ws_url string 是 OneBot 服务器的 WebSocket URL
access_token string 否 连接 OneBot 服务器的访问令牌
allow_from array 否 用户ID白名单,空表示允许所有用户

设置流程

  1. 部署一个 OneBot 兼容的实现(例如napcat)
  2. 配置 OneBot 实现以启用 WebSocket 服务并设置访问令牌(如果需要)
  3. 将 WebSocket URL 和访问令牌填入配置文件中