# OpenClaw 實際設定指南 > 適用版本:OpenClaw v2026.4.x > 更新日期:2026-04-09 --- ## openclaw.json 結構 設定檔位置:`~/.openclaw/openclaw.json` ```json { "agents": { "defaults": { "workspace": "~/.openclaw/workspace", "model": { "primary": "openai-codex/gpt-5.4-mini" } }, "list": [ { "id": "main" }, { "id": "ceo_coo", "name": "ceo_coo", "workspace": "~/.openclaw/workspaces/ceo_coo", "agentDir": "~/.openclaw/agents/ceo_coo/agent", "model": "openai-codex/gpt-5.4" } ] }, "channels": { "discord": { "enabled": true, "token": "", "guilds": { "": { "channels": { "": {} } } } } }, "bindings": [ { "type": "route", "agentId": "ceo_coo", "match": { "channel": "discord", "peer": { "kind": "channel", "id": "" } } } ] } ``` --- ## 新增 Agent ```bash openclaw agents add \ --workspace ~/.openclaw/workspaces/ \ --model \ --non-interactive ``` --- ## Discord 設定 ### 1. 接入 Discord Bot ```bash openclaw channels add --channel discord --token ``` ### 2. Discord Developer Portal 必開設定 Bot → Privileged Gateway Intents: - Message Content Intent ✅ - Server Members Intent ✅ ### 3. 設定 Guild 頻道白名單 在 `openclaw.json` 的 `channels.discord.guilds` 下新增: ```json "guilds": { "": { "channels": { "": {} } } } ``` ### 4. 設定 Agent 路由 Binding ```json "bindings": [ { "type": "route", "agentId": "", "match": { "channel": "discord", "peer": { "kind": "channel", "id": "" } } } ] ``` ### 5. 授權 Discord 用戶 Bot 初次收到 DM 時會顯示 pairing code: ```bash openclaw pairing approve discord ``` --- ## Gateway 管理 Gateway 以 systemd user service 常駐: ```bash # 啟動 systemctl --user start openclaw-gateway.service # 重啟 systemctl --user restart openclaw-gateway.service # 狀態 systemctl --user status openclaw-gateway.service # 查 log journalctl --user -u openclaw-gateway.service -f ``` 設定異動通常不需重啟(熱重載)。 以下異動需要重啟:Discord token、Channel 設定、Plugin 設定。 --- ## 常用指令 ```bash # 查 agent 清單與路由 openclaw agents list --json # 查 channel 連線狀態 openclaw channels status --probe # 查 binding 清單 openclaw agents bindings # 設定 agent 路由 openclaw agents bind --agent --bind "discord:" # 移除 binding openclaw agents unbind --agent --all ``` --- ## King Claw 實際設定 | 項目 | 值 | |---|---| | Guild ID | `1486353934594342924` | | #總機 Channel ID | `1486739757957644319` | | CEO Agent ID | `ceo_coo` | | CEO 模型 | `openai-codex/gpt-5.4` | | 預設模型 | `openai-codex/gpt-5.4-mini` |