Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files
README.md
CHANGED
|
@@ -46,6 +46,7 @@ In your Space settings, add these secrets:
|
|
| 46 |
| `TELEGRAM_BOT_TOKEN` | Your bot token from BotFather | **Yes** |
|
| 47 |
| `BASE_URL` | API base URL (e.g., `http://your-api:20128/v1`) | **Yes** |
|
| 48 |
| `API_KEY` | Your API key | **Yes** |
|
|
|
|
| 49 |
| `MODEL_ID` | Model name (default: `Multiple-models`) | No |
|
| 50 |
| `PROVIDER_NAME` | Provider name (default: `custom`) | No |
|
| 51 |
| `GATEWAY_TOKEN` | Random string for gateway auth | No (auto-generated) |
|
|
@@ -68,6 +69,12 @@ PROVIDER_NAME=9router
|
|
| 68 |
```
|
| 69 |
Replace `your-9router-space` with your actual Space name.
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
### 5. Pair Your Account
|
| 72 |
|
| 73 |
1. Wait for the Space to build and start (check logs)
|
|
|
|
| 46 |
| `TELEGRAM_BOT_TOKEN` | Your bot token from BotFather | **Yes** |
|
| 47 |
| `BASE_URL` | API base URL (e.g., `http://your-api:20128/v1`) | **Yes** |
|
| 48 |
| `API_KEY` | Your API key | **Yes** |
|
| 49 |
+
| `TELEGRAM_USER_ID` | Your numeric Telegram user ID | **Recommended** |
|
| 50 |
| `MODEL_ID` | Model name (default: `Multiple-models`) | No |
|
| 51 |
| `PROVIDER_NAME` | Provider name (default: `custom`) | No |
|
| 52 |
| `GATEWAY_TOKEN` | Random string for gateway auth | No (auto-generated) |
|
|
|
|
| 69 |
```
|
| 70 |
Replace `your-9router-space` with your actual Space name.
|
| 71 |
|
| 72 |
+
**Finding your Telegram User ID:**
|
| 73 |
+
1. Message [@userinfobot](https://t.me/userinfobot) on Telegram
|
| 74 |
+
2. It will reply with your numeric ID (e.g., `123456789`)
|
| 75 |
+
3. Set this as `TELEGRAM_USER_ID` in your HF Space secrets
|
| 76 |
+
4. Without this, anyone can message your bot!
|
| 77 |
+
|
| 78 |
### 5. Pair Your Account
|
| 79 |
|
| 80 |
1. Wait for the Space to build and start (check logs)
|
start.sh
CHANGED
|
@@ -26,6 +26,17 @@ if [ -z "$API_KEY" ] || [ -z "$BASE_URL" ]; then
|
|
| 26 |
echo "โ ๏ธ Warning: API_KEY or BASE_URL not set. AI features won't work."
|
| 27 |
fi
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Set defaults for API
|
| 30 |
BASE_URL=${BASE_URL:-"http://127.0.0.1:20128/v1"}
|
| 31 |
MODEL_ID=${MODEL_ID:-"Multiple-models"}
|
|
@@ -83,7 +94,8 @@ cat > /root/.openclaw/openclaw.json << EOF
|
|
| 83 |
"telegram": {
|
| 84 |
"enabled": true,
|
| 85 |
"botToken": "${TELEGRAM_BOT_TOKEN}",
|
| 86 |
-
"dmPolicy": "
|
|
|
|
| 87 |
"groupPolicy": "allowlist",
|
| 88 |
"capabilities": {
|
| 89 |
"inlineButtons": "allowlist"
|
|
@@ -124,8 +136,10 @@ mkdir -p /root/.openclaw/workspace
|
|
| 124 |
|
| 125 |
# Start OpenClaw Gateway
|
| 126 |
echo "๐ Starting OpenClaw Gateway on port 7860..."
|
| 127 |
-
echo "๐ฑ
|
| 128 |
-
|
|
|
|
|
|
|
| 129 |
echo ""
|
| 130 |
|
| 131 |
exec openclaw gateway
|
|
|
|
| 26 |
echo "โ ๏ธ Warning: API_KEY or BASE_URL not set. AI features won't work."
|
| 27 |
fi
|
| 28 |
|
| 29 |
+
# Set Telegram DM policy based on TELEGRAM_USER_ID
|
| 30 |
+
if [ -n "$TELEGRAM_USER_ID" ]; then
|
| 31 |
+
echo "๐ Restricting bot to Telegram user ID: $TELEGRAM_USER_ID"
|
| 32 |
+
DM_POLICY="allowlist"
|
| 33 |
+
ALLOW_FROM="[$TELEGRAM_USER_ID]"
|
| 34 |
+
else
|
| 35 |
+
echo "โ ๏ธ Warning: TELEGRAM_USER_ID not set. Bot is open to everyone!"
|
| 36 |
+
DM_POLICY="open"
|
| 37 |
+
ALLOW_FROM='["*"]'
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
# Set defaults for API
|
| 41 |
BASE_URL=${BASE_URL:-"http://127.0.0.1:20128/v1"}
|
| 42 |
MODEL_ID=${MODEL_ID:-"Multiple-models"}
|
|
|
|
| 94 |
"telegram": {
|
| 95 |
"enabled": true,
|
| 96 |
"botToken": "${TELEGRAM_BOT_TOKEN}",
|
| 97 |
+
"dmPolicy": "${DM_POLICY}",
|
| 98 |
+
"allowFrom": ${ALLOW_FROM},
|
| 99 |
"groupPolicy": "allowlist",
|
| 100 |
"capabilities": {
|
| 101 |
"inlineButtons": "allowlist"
|
|
|
|
| 136 |
|
| 137 |
# Start OpenClaw Gateway
|
| 138 |
echo "๐ Starting OpenClaw Gateway on port 7860..."
|
| 139 |
+
echo "๐ฑ Bot is ready! Just DM your bot on Telegram."
|
| 140 |
+
if [ -z "$TELEGRAM_USER_ID" ]; then
|
| 141 |
+
echo "โ ๏ธ Warning: TELEGRAM_USER_ID not set - anyone can message your bot!"
|
| 142 |
+
fi
|
| 143 |
echo ""
|
| 144 |
|
| 145 |
exec openclaw gateway
|