feat: add interactive setup scripts for tailscale and telegram

- Add setup-telegram.sh: Interactive script to create bot and configure GitHub Secrets
- Add setup-tailscale.sh: Interactive script to install Tailscale and authenticate
- Add SETUP_COMPLETE.md: Comprehensive setup guide with step-by-step instructions
- Update Makefile with 'make setup-telegram' and 'make setup-tailscale' targets

Features:
- Automated token validation (Telegram API verification)
- GitHub Secrets configuration (with fallback manual instructions)
- Interactive SSH configuration for Tailscale
- Automatic deployment after configuration
- Health checks and verification steps
- Comprehensive troubleshooting guide

Usage:
  make setup-tailscale   # Secure VPS with Tailscale (5 min)
  make setup-telegram    # Configure Telegram bot (10 min)

Scripts guide users through:
1. Tailscale installation and authentication
2. Telegram bot creation with @BotFather
3. Token validation and secret management
4. Deployment and verification
5. Troubleshooting

https://claude.ai/code/session_019vXaqxGmkdCjM8m3jp6rYj
This commit is contained in:
Claude 2026-02-17 19:06:15 +00:00
parent 54e66f9eb0
commit e727907bf8
No known key found for this signature in database
4 changed files with 809 additions and 0 deletions

View file

@ -168,6 +168,14 @@ deploy-hostinger-full:
deploy-hostinger-setup:
@bash deploy/hostinger/setup-server.sh
## setup-telegram: Interactive setup for Telegram bot integration
setup-telegram:
@bash deploy/hostinger/setup-telegram.sh
## setup-tailscale: Interactive setup for Tailscale secure access
setup-tailscale:
@bash deploy/hostinger/setup-tailscale.sh
## deploy-hostinger: Deploy PicoClaw to Hostinger VPS
deploy-hostinger:
@bash deploy/hostinger/deploy.sh \

349
SETUP_COMPLETE.md Normal file
View file

@ -0,0 +1,349 @@
# 🚀 PicoClaw Complete Setup Guide
**Secure Telegram Bot on Hostinger VPS with Tailscale**
---
## 📋 Setup Overview
This guide walks you through:
1. **🔐 Tailscale** - Secure private network access
2. **🤖 Telegram** - Bot integration with @BotFather
3. **✅ Verification** - Test everything works
---
## 🛠️ Prerequisites
- Hostinger VPS running (Ubuntu 20.04+)
- GitHub account and repository
- Telegram account
- SSH access to your VPS
- `make` and `bash` installed locally
- `gh` CLI (optional, for GitHub Secrets automation)
---
## 🎯 Quick Start (3 Steps)
### Step 1: Secure with Tailscale
```bash
make setup-tailscale
```
**What it does:**
- ✅ Installs Tailscale on your VPS
- ✅ Authenticates your VPS to your Tailnet
- ✅ Blocks port 18790 from public internet
- ✅ Creates secure tunnel (only accessible via your Tailscale network)
**Time:** ~5 minutes
---
### Step 2: Setup Telegram Bot
```bash
make setup-telegram
```
**What it does:**
- ✅ Guides you to create bot with @BotFather
- ✅ Validates bot token with Telegram API
- ✅ Configures GitHub Secrets automatically (if gh CLI available)
- ✅ Deploys to your VPS
- ✅ Verifies installation
**Time:** ~10 minutes
---
### Step 3: Test Everything
```bash
# Check Tailscale status
ssh root@YOUR_IP 'tailscale status'
# Check Telegram logs
ssh root@YOUR_IP 'docker exec picoclaw tail -50 /opt/picoclaw/logs/picoclaw.log | grep -i telegram'
# Test Telegram bot
# Open Telegram and find your bot, send /start
```
---
## 📝 Step-by-Step Details
### Phase 1: Initial Server Setup (One-time)
If this is a fresh VPS:
```bash
# SSH into your server
ssh root@YOUR_HOSTINGER_IP
# Or use GitHub Actions to deploy (easier)
git push origin main
# Watch deployment at: https://github.com/YOUR_USER/YOUR_REPO/actions
```
---
### Phase 2: Tailscale Configuration
**Option A: Automated (Recommended)**
```bash
# From your local machine
make setup-tailscale
```
Follow the interactive prompts. The script will:
1. Ask for SSH details
2. Install Tailscale
3. Open authentication link (click in browser)
4. Activate Tailscale serve
5. Verify connectivity
**Option B: Manual (SSH)**
```bash
ssh root@YOUR_IP
# Install Tailscale
curl -fsSL https://tailscale.com/install.sh | sh
# Authenticate
tailscale up --hostname=picoclaw --ssh
# (Copy the URL and open in browser)
# Activate serve
tailscale serve --bg http://localhost:18790
# Verify
tailscale ip -4
```
---
### Phase 3: Telegram Bot Setup
**Option A: Automated (Recommended)**
```bash
# From your local machine
make setup-telegram
```
Follow the interactive prompts. The script will:
1. Guide you to @BotFather
2. Validate your bot token
3. Save to GitHub Secrets
4. Deploy automatically
5. Verify installation
**Option B: Manual (GitHub Secrets)**
1. **Create bot with @BotFather**
- Open Telegram → Search `@BotFather`
- Send `/newbot`
- Give it a name and username
- Copy the token
2. **Add to GitHub Secrets**
```bash
gh secret set PICOCLAW_TELEGRAM_BOT_TOKEN -b YOUR_TOKEN -R your-user/picoclaw
```
3. **Deploy**
```bash
git push origin main
```
4. **Verify**
- Open Telegram, find your bot
- Send `/start`
- Check logs: `ssh root@YOUR_IP tail -f /opt/picoclaw/logs/picoclaw.log | grep telegram`
**Option C: Manual (Direct SSH)**
```bash
ssh root@YOUR_IP
# Edit .env
nano /opt/picoclaw/config/.env
# Add these lines:
PICOCLAW_CHANNELS_TELEGRAM_ENABLED=true
PICOCLAW_CHANNELS_TELEGRAM_TOKEN=YOUR_TOKEN_HERE
# Save and exit (Ctrl+X, Y, Enter)
# Restart Docker
docker compose -f /opt/picoclaw/docker-compose.yml restart picoclaw
# Verify
docker compose logs picoclaw | grep -i telegram
```
---
## ✅ Verification Checklist
After setup is complete, verify everything works:
### 1. Tailscale
```bash
# Check Tailscale is running
ssh root@YOUR_IP 'tailscale status'
# Check serve is active
ssh root@YOUR_IP 'ps aux | grep tailscale'
# Get your Tailnet IP
ssh root@YOUR_IP 'tailscale ip -4'
```
### 2. PicoClaw Gateway
```bash
# Check container is running
ssh root@YOUR_IP 'docker compose ps'
# Check health endpoint (via Tailscale IP)
TAILNET_IP=$(ssh root@YOUR_IP 'tailscale ip -4')
curl http://$TAILNET_IP:18790/health
# Check gateway is listening on localhost only
ssh root@YOUR_IP 'netstat -tuln | grep 18790'
# Should show: 127.0.0.1:18790 (NOT 0.0.0.0)
```
### 3. Telegram Bot
```bash
# Check logs for Telegram initialization
ssh root@YOUR_IP 'docker compose logs picoclaw | grep -i telegram'
# Expected output should include:
# "Starting Telegram bot (polling mode)..."
# "Telegram bot connected"
```
### 4. Test Telegram Bot
1. Open Telegram
2. Search for your bot (username from @BotFather)
3. Click **Start**
4. Send a message
Expected response:
```
Thinking... 💭
[Claude's response]
```
---
## 🔐 Security Summary
| Component | Status | Access Method |
|-----------|--------|----------------|
| SSH | 🔒 Protected | Tailscale tunnel |
| PicoClaw Gateway (18790) | 🔒 Protected | Tailscale tunnel only |
| Telegram Bot | 🌐 Public | via Telegram API |
| Config/Secrets | 🔐 Encrypted | GitHub Secrets |
**What's protected:**
- ✅ Port 18790 is NOT exposed to the internet
- ✅ Accessible only via your Tailscale network
- ✅ UFW firewall blocks public access
- ✅ Bot token stored in GitHub Secrets (never in code)
---
## 🐛 Troubleshooting
### Tailscale not authenticating
```bash
# Check if already authenticated
ssh root@YOUR_IP 'tailscale status'
# If not, try again
ssh root@YOUR_IP 'tailscale up --hostname=picoclaw'
```
### Telegram bot not responding
```bash
# Check if Telegram is enabled
ssh root@YOUR_IP 'grep TELEGRAM /opt/picoclaw/config/.env'
# Check logs
ssh root@YOUR_IP 'docker compose logs picoclaw | grep -i telegram'
# Verify token is correct (should start with numbers:)
ssh root@YOUR_IP 'grep TELEGRAM_TOKEN /opt/picoclaw/config/.env'
```
### Can't reach PicoClaw via Tailscale
```bash
# Check Tailscale IP
ssh root@YOUR_IP 'tailscale ip -4'
# Check if port is listening
ssh root@YOUR_IP 'netstat -tuln | grep 18790'
# Check if Docker container is running
ssh root@YOUR_IP 'docker compose ps'
# Check logs
ssh root@YOUR_IP 'docker compose logs picoclaw | tail -50'
```
---
## 📚 Additional Resources
- **Tailscale Docs**: https://tailscale.com/kb/
- **Telegram Bot API**: https://core.telegram.org/bots
- **PicoClaw Telegram Setup**: [docs/TELEGRAM_SETUP.md](docs/TELEGRAM_SETUP.md)
- **PicoClaw Quickstart**: [TELEGRAM_QUICKSTART.md](TELEGRAM_QUICKSTART.md)
---
## 🎬 Next Steps
1. **Run `make setup-tailscale`** - Secure your VPS
2. **Run `make setup-telegram`** - Add Telegram bot
3. **Test your bot** - Send a message on Telegram
4. **Configure whitelist** (optional) - Restrict to specific users
5. **Set up monitoring** (optional) - Get alerts on failures
---
## ❓ FAQ
**Q: Why Tailscale?**
A: It creates a private network between your devices and VPS. Port 18790 stays hidden from the internet while remaining accessible to you.
**Q: Can others use my bot without Tailscale?**
A: Yes! The Telegram bot is public (everyone can talk to it), but the PicoClaw gateway behind it is private (only you can manage it via Tailscale).
**Q: How much does Tailscale cost?**
A: Free for personal use (up to 100 devices). Perfect for this setup.
**Q: What if I lose my device?**
A: Remove it from your Tailnet at https://login.tailscale.com. It will lose access immediately.
**Q: Can I use a different VPN?**
A: Sure, but you'll need to configure a different security tunnel yourself. Tailscale is recommended for simplicity.
---
**Happy deploying! 🚀**

View file

@ -0,0 +1,195 @@
#!/usr/bin/env bash
# ============================================================
# PicoClaw - Tailscale Setup Script
# ============================================================
# Guides you through Tailscale setup and configuration
#
# Usage:
# bash deploy/hostinger/setup-tailscale.sh
# OR
# make setup-tailscale
# ============================================================
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log() { echo -e "${GREEN}${NC} $*"; }
warn() { echo -e "${YELLOW}${NC} $*"; }
error() { echo -e "${RED}${NC} $*"; exit 1; }
info() { echo -e "${BLUE}${NC} $*"; }
header() { echo -e "\n${BLUE}══════════════════════════════════════${NC}\n$*\n${BLUE}══════════════════════════════════════${NC}\n"; }
# ── Configuration ──────────────────────────────────────
SSH_HOST=""
SSH_USER="root"
SSH_PORT="22"
header "🔐 PicoClaw Tailscale Setup"
# ── Step 1: Collect SSH Details ────────────────────────
step_ssh_details() {
header "Step 1⃣ SSH Connection Details"
info "Enter your Hostinger VPS details"
read -p "Server IP or hostname: " SSH_HOST
read -p "SSH user (default: root): " SSH_USER_INPUT
SSH_USER="${SSH_USER_INPUT:-root}"
read -p "SSH port (default: 22): " SSH_PORT_INPUT
SSH_PORT="${SSH_PORT_INPUT:-22}"
log "SSH Details: ${GREEN}${SSH_USER}@${SSH_HOST}:${SSH_PORT}${NC}"
}
# ── Step 2: Install Tailscale ──────────────────────────
step_install_tailscale() {
header "Step 2⃣ Install Tailscale on Server"
info "Installing Tailscale..."
ssh -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" <<'EOF'
if command -v tailscale &>/dev/null; then
echo "✓ Tailscale already installed"
exit 0
fi
echo "Installing Tailscale..."
curl -fsSL https://tailscale.com/install.sh | sh
if command -v tailscale &>/dev/null; then
echo "✓ Tailscale installed successfully"
else
echo "✗ Failed to install Tailscale"
exit 1
fi
EOF
log "Tailscale installed"
}
# ── Step 3: Authenticate with Tailscale ───────────────
step_authenticate() {
header "Step 3⃣ Authenticate with Tailscale"
info "Opening Tailscale authentication..."
info "A URL will appear below. Open it in your browser and authorize."
echo ""
ssh -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" <<'EOF'
echo "Starting Tailscale authentication..."
echo "Click the link below or open it in your browser:"
echo ""
tailscale up --hostname=picoclaw --ssh
echo ""
echo "✓ Tailscale authentication complete"
tailscale ip -4
EOF
log "Tailscale authenticated"
}
# ── Step 4: Configure Tailscale Serve ──────────────────
step_configure_serve() {
header "Step 4⃣ Configure Tailscale Serve"
info "Configuring Tailscale to expose PicoClaw on tailnet..."
ssh -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" <<'EOF'
tailscale serve --bg http://localhost:18790
echo "✓ Tailscale serve configured"
echo ""
echo "Your PicoClaw is now accessible at:"
tailscale ip -4 | while read ip; do
echo " http://$ip:18790"
done
echo " https://picoclaw.$(tailscale status --json | grep -o '"Self":{"ID":"[^"]*' | grep -o '"[^"]*$' | tr -d '"' | sed 's/.*\.//' | head -1).ts.net"
EOF
log "Tailscale serve active"
}
# ── Step 5: Verify Access ──────────────────────────────
step_verify_access() {
header "Step 5⃣ Verify Access"
info "Testing Tailscale connection..."
TAILNET_IP=$(ssh -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" "tailscale ip -4" 2>/dev/null || echo "")
if [ -z "$TAILNET_IP" ]; then
warn "Could not get Tailscale IP"
return 0
fi
log "Tailscale IP: ${BLUE}${TAILNET_IP}${NC}"
# Try to curl the health endpoint
if curl -sf "http://${TAILNET_IP}:18790/health" >/dev/null 2>&1; then
log "✨ PicoClaw is accessible via Tailscale!"
echo ""
info "Access PicoClaw at: ${BLUE}http://${TAILNET_IP}:18790${NC}"
else
warn "Could not connect to PicoClaw (might be still starting)"
echo ""
info "Try manually: ${BLUE}curl http://${TAILNET_IP}:18790/health${NC}"
fi
}
# ── Step 6: Show Next Steps ────────────────────────────
step_next_steps() {
header "✨ Tailscale Setup Complete!"
echo ""
echo " ${GREEN}Your PicoClaw VPS is now secured with Tailscale${NC}"
echo ""
echo " ${BLUE}Port 18790 is ${GREEN}NOT${BLUE} accessible from the internet${NC}"
echo " ${BLUE}Only accessible via your Tailnet${NC}"
echo ""
echo " ${YELLOW}Next steps:${NC}"
echo " 1. Get your Tailscale IP:"
echo " ${BLUE}ssh ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'tailscale ip -4'${NC}"
echo ""
echo " 2. Access PicoClaw:"
echo " ${BLUE}http://<TAILSCALE_IP>:18790${NC}"
echo ""
echo " 3. SSH via Tailscale:"
echo " ${BLUE}tailscale list${NC} (to see devices)"
echo " ${BLUE}ssh picoclaw.${USER}.ts.net${NC}"
echo ""
echo " 4. Set up Telegram bot:"
echo " ${BLUE}make setup-telegram${NC}"
echo ""
}
# ── Main Execution ────────────────────────────────────
main() {
info "This script will set up Tailscale to secure your PicoClaw"
echo ""
echo " What it does:"
echo " • Installs Tailscale on your Hostinger VPS"
echo " • Authenticates with your Tailnet"
echo " • Exposes PicoClaw only on Tailscale"
echo " • Blocks public internet access to port 18790"
echo ""
read -p "Continue? (y/n): " proceed
[ "$proceed" != "y" ] && error "Aborted by user"
step_ssh_details
step_install_tailscale
step_authenticate
step_configure_serve
step_verify_access
step_next_steps
}
# ── Run ────────────────────────────────────────────────
main

View file

@ -0,0 +1,257 @@
#!/usr/bin/env bash
# ============================================================
# PicoClaw - Telegram Bot Setup Script
# ============================================================
# Interactive setup for Telegram bot integration
#
# Usage:
# bash deploy/hostinger/setup-telegram.sh
# ============================================================
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log() { echo -e "${GREEN}${NC} $*"; }
warn() { echo -e "${YELLOW}${NC} $*"; }
error() { echo -e "${RED}${NC} $*"; exit 1; }
info() { echo -e "${BLUE}${NC} $*"; }
header() { echo -e "\n${BLUE}══════════════════════════════════════${NC}\n$*\n${BLUE}══════════════════════════════════════${NC}\n"; }
# ── Configuration ──────────────────────────────────────
PICOCLAW_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
TELEGRAM_TOKEN=""
GITHUB_REPO=""
GITHUB_TOKEN=""
SSH_HOST=""
header "🤖 PicoClaw Telegram Bot Setup"
# ── Step 1: Create Bot with BotFather ──────────────────
step_create_bot() {
header "Step 1⃣ Create Telegram Bot with @BotFather"
echo "Follow these steps in Telegram:"
echo ""
echo " 1. Open Telegram and search for: ${BLUE}@BotFather${NC}"
echo " 2. Send: ${GREEN}/start${NC}"
echo " 3. Send: ${GREEN}/newbot${NC}"
echo " 4. Give it a ${BLUE}Name${NC} (e.g., 'PicoClaw AI')"
echo " 5. Give it a ${BLUE}Username${NC} (e.g., 'picoclaw_bot')"
echo " ${YELLOW}⚠ Must be unique and end with _bot${NC}"
echo " 6. ${GREEN}Copy the token${NC} provided by BotFather"
echo ""
read -p "Paste your bot token here: " TELEGRAM_TOKEN
if [ -z "$TELEGRAM_TOKEN" ]; then
error "Bot token cannot be empty!"
fi
# Basic validation: should be numbers:letters format
if [[ ! $TELEGRAM_TOKEN =~ ^[0-9]+:[A-Za-z0-9_-]+$ ]]; then
warn "Token format looks unusual. Continue? (y/n)"
read -p "" confirm
[ "$confirm" != "y" ] && error "Aborted"
fi
log "Bot token saved: ${TELEGRAM_TOKEN:0:20}..."
}
# ── Step 2: Test Bot ───────────────────────────────────
step_test_bot() {
header "Step 2⃣ Test Your Bot Token"
info "Validating token with Telegram API..."
RESPONSE=$(curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/getMe")
if echo "$RESPONSE" | grep -q '"ok":true'; then
BOT_USERNAME=$(echo "$RESPONSE" | grep -o '"username":"[^"]*' | cut -d'"' -f4)
BOT_NAME=$(echo "$RESPONSE" | grep -o '"first_name":"[^"]*' | cut -d'"' -f4)
log "Bot token is valid! ✨"
log "Bot Name: ${BLUE}$BOT_NAME${NC}"
log "Bot Username: ${BLUE}@$BOT_USERNAME${NC}"
echo ""
info "Find your bot on Telegram: ${GREEN}@$BOT_USERNAME${NC}"
else
error "Invalid bot token! Please check and try again."
fi
}
# ── Step 3: GitHub Setup ───────────────────────────────
step_github_setup() {
header "Step 3⃣ Configure GitHub Secrets"
info "Checking for 'gh' CLI..."
if ! command -v gh &>/dev/null; then
warn "GitHub CLI not installed. Please add the secret manually:"
echo ""
echo " 1. Go to: ${BLUE}https://github.com/YOUR_USER/YOUR_REPO/settings/secrets/actions${NC}"
echo " 2. Click ${GREEN}New repository secret${NC}"
echo " 3. Name: ${GREEN}PICOCLAW_TELEGRAM_BOT_TOKEN${NC}"
echo " 4. Value: ${GREEN}${TELEGRAM_TOKEN:0:30}...${NC}"
echo ""
return 0
fi
# Get repo info
if [ -z "$GITHUB_REPO" ]; then
info "Detecting GitHub repository..."
GITHUB_REPO=$(cd "$PICOCLAW_DIR" && git config --get remote.origin.url | sed 's/.*:\(.*\)\.git/\1/')
fi
if [ -z "$GITHUB_REPO" ]; then
warn "Could not detect GitHub repo. Please enter manually:"
read -p "GitHub repo (user/repo): " GITHUB_REPO
fi
info "Repository: ${BLUE}$GITHUB_REPO${NC}"
# Try to set secret with gh CLI
if gh secret set PICOCLAW_TELEGRAM_BOT_TOKEN --body "$TELEGRAM_TOKEN" -R "$GITHUB_REPO" 2>/dev/null; then
log "GitHub secret configured! 🔐"
else
warn "Could not set GitHub secret via CLI"
echo ""
echo "Set it manually:"
echo " ${BLUE}gh secret set PICOCLAW_TELEGRAM_BOT_TOKEN -b '$TELEGRAM_TOKEN' -R '$GITHUB_REPO'${NC}"
fi
}
# ── Step 4: Configure Locally (for testing) ───────────
step_configure_local() {
header "Step 4⃣ Configure Locally (Optional - for testing)"
read -p "Configure locally for testing? (y/n): " configure_local
if [ "$configure_local" != "y" ]; then
info "Skipping local configuration"
return 0
fi
ENV_FILE="${PICOCLAW_DIR}/config/.env"
CONFIG_FILE="${PICOCLAW_DIR}/config/config.json"
info "Updating .env file..."
if grep -q "PICOCLAW_CHANNELS_TELEGRAM_TOKEN" "$ENV_FILE" 2>/dev/null; then
sed -i "s|^PICOCLAW_CHANNELS_TELEGRAM_TOKEN=.*|PICOCLAW_CHANNELS_TELEGRAM_TOKEN=$TELEGRAM_TOKEN|" "$ENV_FILE"
else
echo "PICOCLAW_CHANNELS_TELEGRAM_TOKEN=$TELEGRAM_TOKEN" >> "$ENV_FILE"
fi
if grep -q "PICOCLAW_CHANNELS_TELEGRAM_ENABLED" "$ENV_FILE" 2>/dev/null; then
sed -i 's/^PICOCLAW_CHANNELS_TELEGRAM_ENABLED=.*/PICOCLAW_CHANNELS_TELEGRAM_ENABLED=true/' "$ENV_FILE"
else
echo "PICOCLAW_CHANNELS_TELEGRAM_ENABLED=true" >> "$ENV_FILE"
fi
log ".env file updated"
# Update config.json
if command -v jq &>/dev/null && [ -f "$CONFIG_FILE" ]; then
info "Updating config.json..."
jq '.channels.telegram.enabled = true | .channels.telegram.token = ""' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp"
mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
log "config.json updated"
fi
}
# ── Step 5: Deploy ───────────────────────────────────
step_deploy() {
header "Step 5⃣ Deploy to Hostinger"
read -p "Ready to deploy? (y/n): " deploy_ready
if [ "$deploy_ready" != "y" ]; then
info "Skipping deployment"
return 0
fi
info "Pushing code changes..."
cd "$PICOCLAW_DIR"
if git diff --quiet; then
info "No local changes to commit"
else
warn "Local changes detected"
git status
read -p "Commit and push? (y/n): " commit_ready
if [ "$commit_ready" = "y" ]; then
git add .
git commit -m "chore: configure telegram bot integration"
git push origin claude/hostinger-remote-deployment-TGVof
fi
fi
info "GitHub Actions deployment triggered..."
info "Check status at: ${BLUE}https://github.com/$GITHUB_REPO/actions${NC}"
}
# ── Step 6: Verification ───────────────────────────────
step_verify() {
header "Step 6⃣ Verify Installation"
info "Your Telegram bot is now live!"
echo ""
echo " ${GREEN}Find your bot on Telegram and send: /start${NC}"
echo ""
read -p "Check logs on server? (y/n): " check_logs
if [ "$check_logs" != "y" ]; then
return 0
fi
info "Enter SSH details:"
read -p "Server IP or hostname: " SSH_HOST
read -p "SSH user (default: root): " SSH_USER
SSH_USER="${SSH_USER:-root}"
info "Connecting to server..."
ssh -t "${SSH_USER}@${SSH_HOST}" \
'tail -50 /opt/picoclaw/logs/picoclaw.log | grep -i telegram'
}
# ── Main Execution ────────────────────────────────────
main() {
info "This script will:"
echo " 1. Create a Telegram bot with @BotFather"
echo " 2. Validate the bot token"
echo " 3. Configure GitHub Secrets for CI/CD"
echo " 4. (Optional) Configure locally for testing"
echo " 5. Deploy to your Hostinger VPS"
echo " 6. Verify the installation"
echo ""
read -p "Continue? (y/n): " proceed
[ "$proceed" != "y" ] && error "Aborted by user"
step_create_bot
step_test_bot
step_github_setup
step_configure_local
step_deploy
step_verify
header "✨ Setup Complete!"
echo ""
echo " ${GREEN}Your PicoClaw Telegram bot is ready!${NC}"
echo ""
echo " Next steps:"
echo " 1. Open Telegram and find your bot"
echo " 2. Send /start"
echo " 3. Start chatting!"
echo ""
echo " For troubleshooting, see: ${BLUE}docs/TELEGRAM_SETUP.md${NC}"
echo ""
}
# ── Run ────────────────────────────────────────────────
main