somratpro commited on
Commit
4b80115
Β·
1 Parent(s): 4b1a273

feat: add TELEGRAM_NATIVE_COMMANDS configuration and update telegram channel settings to use object merging

Browse files
Files changed (1) hide show
  1. start.sh +6 -2
start.sh CHANGED
@@ -18,12 +18,14 @@ if [ -n "${SPACE_HOST:-}" ]; then
18
  OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-warn}"
19
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
20
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
 
21
  # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
22
  export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
23
  else
24
  OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-info}"
25
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
26
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-pretty}"
 
27
  fi
28
  echo ""
29
  echo " ╔══════════════════════════════════════════╗"
@@ -324,14 +326,16 @@ fi
324
  if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
325
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
326
  export TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN"
 
 
327
 
328
  if [ -n "${TELEGRAM_USER_IDS:-}" ]; then
329
  # Convert comma-separated IDs to JSON array
330
  IDS_JSON=$(echo "$TELEGRAM_USER_IDS" | tr ',' '\n' | sed 's/^ *//;s/ *$//' | jq -R . | jq -s .)
331
- CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram = {\"dmPolicy\": \"allowlist\", \"allowFrom\": $IDS_JSON}")
332
  elif [ -n "${TELEGRAM_USER_ID:-}" ]; then
333
  # Single user (backward compatible)
334
- CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram = {\"dmPolicy\": \"allowlist\", \"allowFrom\": [\"$TELEGRAM_USER_ID\"]}")
335
  fi
336
  fi
337
 
 
18
  OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-warn}"
19
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
20
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
21
+ TELEGRAM_NATIVE_COMMANDS="${TELEGRAM_NATIVE_COMMANDS:-}"
22
  # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
23
  export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
24
  else
25
  OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-info}"
26
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
27
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-pretty}"
28
+ TELEGRAM_NATIVE_COMMANDS="${TELEGRAM_NATIVE_COMMANDS:-auto}"
29
  fi
30
  echo ""
31
  echo " ╔══════════════════════════════════════════╗"
 
326
  if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
327
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
328
  export TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN"
329
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram.enabled = true")
330
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram.commands.native = \"$TELEGRAM_NATIVE_COMMANDS\"")
331
 
332
  if [ -n "${TELEGRAM_USER_IDS:-}" ]; then
333
  # Convert comma-separated IDs to JSON array
334
  IDS_JSON=$(echo "$TELEGRAM_USER_IDS" | tr ',' '\n' | sed 's/^ *//;s/ *$//' | jq -R . | jq -s .)
335
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram += {\"dmPolicy\": \"allowlist\", \"allowFrom\": $IDS_JSON}")
336
  elif [ -n "${TELEGRAM_USER_ID:-}" ]; then
337
  # Single user (backward compatible)
338
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".channels.telegram += {\"dmPolicy\": \"allowlist\", \"allowFrom\": [\"$TELEGRAM_USER_ID\"]}")
339
  fi
340
  fi
341