File size: 1,190 Bytes
12c15de | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/bash
# scripts/feishu-setup.sh — 飞书 5 机器人通道 + 5 Agent 绑定
set -e
STATE_DIR="${OPENCLAW_STATE_DIR:-/root/.openclaw}"
echo "🦞 Configuring Feishu channels..."
# 启用飞书插件
openclaw plugins enable feishu 2>/dev/null || true
for i in 1 2 3 4 5; do
app_id_var="FEISHU_APP_ID_${i}"
app_sec_var="FEISHU_APP_SECRET_${i}"
enabled_var="FEISHU_ENABLED_${i}"
app_id="${!app_id_var}"
app_sec="${!app_sec_var}"
enabled="${!enabled_var:-false}"
if [[ -n "$app_id" && -n "$app_sec" && "$enabled" == "true" ]]; then
account_id="feishu-agent-${i}"
echo " → Robot ${i} (${account_id})..."
export FEISHU_APP_ID="$app_id"
export FEISHU_APP_SECRET="$app_sec"
# Add channel account
openclaw channels add \
--channel feishu \
--account "$account_id" \
--token "${app_id}:${app_sec}" 2>/dev/null || \
openclaw config set "channels.${account_id}" "$(cat <<JSONEOF
{ "type": "feishu", "appId": "${app_id}", "appSecret": "${app_sec}" }
JSONEOF
)" 2>/dev/null || true
echo " ✅ Robot ${i} configured"
fi
done
echo "✅ Feishu setup done" |