# OneBot 11 适配器配置示例 [bot] # 机器人自身ID(QQ号) self_id = "123456789" # 机器人昵称 nickname = "MyBot" # ===== 连接方式配置 ===== # 支持的连接类型: ws, ws-reverse, http, http-post connection_type = "ws" # ===== 正向 WebSocket 配置 ===== # 当 connection_type = "ws" 时使用 [websocket] # WebSocket 服务器地址 ws_url = "ws://127.0.0.1:6700" # 访问令牌(可选) access_token = "" # 心跳间隔(秒) heartbeat = 30 # 重连间隔(秒) reconnect_interval = 5 # ===== 反向 WebSocket 配置 ===== # 当 connection_type = "ws-reverse" 时使用 [websocket_reverse] # 反向 WebSocket 监听地址 ws_reverse_url = "0.0.0.0:8080" # 访问令牌(可选) access_token = "" # ===== HTTP 配置 ===== # 当 connection_type = "http" 时使用 [http] # HTTP API 地址 http_url = "http://127.0.0.1:5700" # 访问令牌(可选) access_token = "" # 超时时间(秒) timeout = 30 # ===== HTTP POST 上报配置 ===== # 当 connection_type = "http-post" 时使用 [http_post] # HTTP POST 上报地址 http_post_url = "http://127.0.0.1:8080/onebot" # 签名密钥(可选) secret = "" # 超时时间(秒) timeout = 30 # ===== 完整配置示例 ===== # 示例 1: 使用正向 WebSocket # [[bots]] # self_id = "123456789" # nickname = "Bot1" # connection_type = "ws" # ws_url = "ws://127.0.0.1:6700" # access_token = "your_token_here" # timeout = 30 # 示例 2: 使用 HTTP # [[bots]] # self_id = "987654321" # nickname = "Bot2" # connection_type = "http" # http_url = "http://127.0.0.1:5700" # access_token = "your_token_here" # timeout = 30 # 示例 3: 使用反向 WebSocket # [[bots]] # self_id = "111222333" # nickname = "Bot3" # connection_type = "ws-reverse" # ws_reverse_url = "0.0.0.0:8080" # access_token = "your_token_here" # 示例 4: 使用 HTTP POST # [[bots]] # self_id = "444555666" # nickname = "Bot4" # connection_type = "http-post" # http_post_url = "http://127.0.0.1:8080/onebot" # secret = "your_secret_here" # timeout = 30