#!/usr/bin/env bash set -euo pipefail BASE_URL="${BASE_URL:-http://127.0.0.1:8790}" AUTH_TOKEN="${AUTH_TOKEN:-}" CALLER_ID="${CALLER_ID:-}" AUTH_HEADER=() if [[ -n "$AUTH_TOKEN" ]]; then AUTH_HEADER=(-H "Authorization: Bearer ${AUTH_TOKEN}") fi CALLER_HEADER=() if [[ -n "$CALLER_ID" ]]; then CALLER_HEADER=(-H "X-OpenClaw-Caller-Id: ${CALLER_ID}") fi echo "[1] health" curl -sS "${BASE_URL}/health" | sed -n '1,20p' if [[ -z "${GUILD_ID:-}" ]]; then echo "skip action checks: set GUILD_ID (and optional CHANNEL_ID) to run dryRun actions" exit 0 fi echo "[2] dry-run private create" curl -sS -X POST "${BASE_URL}/v1/discord/action" \ -H 'Content-Type: application/json' \ "${AUTH_HEADER[@]}" \ "${CALLER_HEADER[@]}" \ -d "{\"action\":\"channel-private-create\",\"guildId\":\"${GUILD_ID}\",\"name\":\"wg-dryrun\",\"dryRun\":true}" \ | sed -n '1,80p' if [[ -n "${CHANNEL_ID:-}" ]]; then echo "[3] dry-run private update" curl -sS -X POST "${BASE_URL}/v1/discord/action" \ -H 'Content-Type: application/json' \ "${AUTH_HEADER[@]}" \ "${CALLER_HEADER[@]}" \ -d "{\"action\":\"channel-private-update\",\"guildId\":\"${GUILD_ID}\",\"channelId\":\"${CHANNEL_ID}\",\"mode\":\"merge\",\"dryRun\":true}" \ | sed -n '1,100p' fi echo "[4] member-list (limit=1)" curl -sS -X POST "${BASE_URL}/v1/discord/action" \ -H 'Content-Type: application/json' \ "${AUTH_HEADER[@]}" \ "${CALLER_HEADER[@]}" \ -d "{\"action\":\"member-list\",\"guildId\":\"${GUILD_ID}\",\"limit\":1,\"fields\":[\"user.id\",\"user.username\"]}" \ | sed -n '1,120p' echo "smoke-discord-control: done"