File size: 1,691 Bytes
a2fb4d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Deploy to Render.com (Free 24/7 Hosting)

## Step 1: Create Render Account

1. Go to **https://render.com**
2. Sign up with your GitHub account

## Step 2: Push Code to GitHub

```bash
cd C:\Users\abbasyk\Documents\opencode-hf-space
git init
git add -A
git commit -m "Initial commit"
git remote add origin https://github.com/YOUR_USERNAME/opencode-bot.git
git push -u origin main
```

## Step 3: Create Background Worker on Render

1. Go to **https://dashboard.render.com**
2. Click **"New +"****"Background Worker"**
3. Connect your GitHub repo
4. Settings:
   - **Name**: opencode-telegram-bot
   - **Runtime**: Node
   - **Build Command**: `npm install`
   - **Start Command**: `node bot.js`
5. Click **"Advanced"** → Add these **Environment Variables**:

| Key | Value |
|-----|-------|
| `TELEGRAM_BOT_TOKEN` | `8835963099:AAHvLdFqbpsfDs3hTUBXuFQzSo3LSpedd6k` |
| `TELEGRAM_CHAT_ID` | `6922119748` |
| `OPENCODE_ZEN_KEY` | `sk-1IwuYl2EKD0bNtmoEPqBVuWQHlKlc7gN5VLFZnjBrGTUbg7O1376dM9eYg8AHaUv` |

6. Click **"Create Background Worker"**

## Step 4: Verify

- Go to your service page on Render
- Check **"Logs"** tab - you should see:
  ```
  [OK] Starting Telegram bot...
  [OK] Telegram bot is running!
  ```

## Free Tier Limitations

- **750 hours/month** (enough for 24/7)
- **Sleeps after 15 min** of inactivity (but Telegram bot keeps it awake)
- **Spins up in ~30 seconds** when new message arrives

## Alternative: Fly.io

If Render doesn't work, try Fly.io:
1. Install: `curl -L https://fly.io/install.sh | sh`
2. Run: `fly auth login`
3. Run: `fly launch`
4. Run: `fly secrets set TELEGRAM_BOT_TOKEN=... TELEGRAM_CHAT_ID=... OPENCODE_ZEN_KEY=...`
5. Run: `fly deploy`