Telegram userbot relay that monitors specified group chats and forwards bot messages to OpenClaw's inject-http endpoint via webhook. Features: - GramJS (MTProto) for reading bot messages (invisible to Bot API) - Media download + multipart form upload - BOT_EXCLUDE filter (by user ID or @username) - HTML entity formatting (bold, italic, code, pre, links, etc.) - Graceful shutdown on SIGINT/SIGTERM - .env configuration with validation
27 lines
591 B
Markdown
27 lines
591 B
Markdown
# Intergram-JS - GramJS Telegram Relay
|
||
|
||
Telegram userbot,監聽指定群組訊息並轉發到 Webhook endpoint。
|
||
GramJS (Node.js) 版本,對標 Python Telethon 版 intergram。
|
||
|
||
## 技術棧
|
||
|
||
- Node.js >= 22 (ESM)
|
||
- telegram (GramJS) - Telegram userbot client
|
||
- 原生 fetch + FormData (Node 22+ 內建)
|
||
|
||
## 常用指令
|
||
|
||
```bash
|
||
# 安裝依賴
|
||
npm install
|
||
|
||
# 啟動
|
||
node main.js
|
||
```
|
||
|
||
## 架構
|
||
|
||
- `main.js` - 入口點
|
||
- `src/config.js` - 環境變數載入與驗證
|
||
- `src/formatter.js` - Telegram Message → Webhook JSON 轉換
|
||
- `src/relay.js` - GramJS 事件監聽 + fetch 轉發
|