feat: initial commit — GramJS Telegram relay for OpenClaw inject
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
This commit is contained in:
commit
cd56658c7f
9 changed files with 1345 additions and 0 deletions
27
CLAUDE.md
Normal file
27
CLAUDE.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# 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 轉發
|
||||
Loading…
Add table
Add a link
Reference in a new issue