Add bindings update and discord account config to onboard script

This commit is contained in:
lyn
2026-04-12 15:18:46 +00:00
parent 8f3055be62
commit 2e9be8375c

View File

@@ -74,6 +74,55 @@ ego-mgr set email "${NAME}@${ROLE}.hangman-lab.top"
ego-mgr set agent-id "$AGENT_ID" ego-mgr set agent-id "$AGENT_ID"
ego-mgr set date-of-birth "$TODAY" ego-mgr set date-of-birth "$TODAY"
BINDINGS_LOCK="$HOME/.openclaw/states/bindings.lock"
STATE_DIR="$HOME/.openclaw/states"
# Wait for bindings.lock to disappear
while [[ -f "$BINDINGS_LOCK" ]]; do
echo "bindings locked, waiting..."
sleep 10
done
# Create bindings.lock and update bindings
mkdir -p "$STATE_DIR"
touch "$BINDINGS_LOCK"
CURRENT_BINDINGS=$(openclaw config get bindings 2>/dev/null || echo "[]")
# Replace accountId "interviewee" -> "{name}" for this agent
UPDATED_BINDINGS=$(echo "$CURRENT_BINDINGS" | python3 -c "
import sys, json
bindings = json.load(sys.stdin)
for b in bindings:
if b.get('agentId') == '$AGENT_ID' and b.get('match', {}).get('accountId') == 'interviewee':
b['match']['accountId'] = '$NAME'
print(json.dumps(bindings))
" 2>/dev/null)
openclaw config set bindings "$UPDATED_BINDINGS"
rm -f "$BINDINGS_LOCK"
# Configure discord account for {name}
openclaw config set channels.discord.accounts."$NAME".enabled true
openclaw config set channels.discord.accounts."$NAME".commands.native true
openclaw config set channels.discord.accounts."$NAME".commands.nativeSkills true
openclaw config set channels.discord.accounts."$NAME".token "$BOT_TOKEN"
openclaw config set channels.discord.accounts."$NAME".allowBots true
openclaw config set channels.discord.accounts."$NAME".groupPolicy "open"
openclaw config set channels.discord.accounts."$NAME".streaming.mode "off"
openclaw config set channels.discord.accounts."$NAME".actions.messages true
openclaw config set channels.discord.accounts."$NAME".actions.search true
openclaw config set channels.discord.accounts."$NAME".actions.roles true
openclaw config set channels.discord.accounts."$NAME".actions.channelInfo true
openclaw config set channels.discord.accounts."$NAME".actions.events true
openclaw config set channels.discord.accounts."$NAME".actions.channels true
openclaw config set channels.discord.accounts."$NAME".dmPolicy "open"
openclaw config set channels.discord.accounts."$NAME".allowFrom '["*"]'
openclaw config set channels.discord.accounts."$NAME".dm.enabled true
openclaw config set channels.discord.accounts."$NAME".execApprovals.enabled false
openclaw config set channels.discord.accounts."$NAME".execApprovals.approvers '["*"]'
~/.openclaw/skills/keycloak-hangman-lab/scripts/create-keycloak-account ~/.openclaw/skills/keycloak-hangman-lab/scripts/create-keycloak-account
~/.openclaw/skills/git-hangman-lab/scripts/create-git-account ~/.openclaw/skills/git-hangman-lab/scripts/create-git-account
~/.openclaw/skills/git-hangman-lab/scripts/link-keycloak ~/.openclaw/skills/git-hangman-lab/scripts/link-keycloak