ilang-ai commited on
Commit
5eb88a0
·
1 Parent(s): 972b6f2

v4.2: README rewrite — user journey (use now → install → deploy) + Chinese version

Browse files

- Lead with official bot: add @iLangGuardBot to your group, done
- VPS one-line install second
- HF Space third
- README_CN.md full Chinese version
- Both versions link to each other

Files changed (2) hide show
  1. README.md +64 -92
  2. README_CN.md +160 -0
README.md CHANGED
@@ -23,80 +23,77 @@ Anti-spam. Vision. Chat. No topic off-limits.
23
 
24
  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
25
  [![Powered by I-Lang](https://img.shields.io/badge/powered%20by-I--Lang%20Spec-blueviolet)](https://ilang.ai)
26
- [![Deploy on HF](https://img.shields.io/badge/deploy-HuggingFace%20Space-yellow)](https://huggingface.co/spaces/i-Lang/TelegramGuard)
27
  [![Gemini](https://img.shields.io/badge/AI-Gemini%202.5%20Flash-4285F4)](https://aistudio.google.com)
28
 
29
- </div>
30
-
31
- ---
32
-
33
- ## One-Line Install (VPS)
34
-
35
- ```bash
36
- curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.sh | sudo bash
37
- ```
38
 
39
- That's it. The script clones, installs, asks for your tokens, creates a system service, and starts.
40
-
41
- You need two things (both free):
42
- - **Bot Token** from [@BotFather](https://t.me/BotFather) on Telegram
43
- - **Gemini API Key** from [aistudio.google.com/apikey](https://aistudio.google.com/apikey)
44
 
45
  ---
46
 
47
- ## What Makes This Different
48
 
49
- Most Telegram bots refuse to discuss anything remotely sensitive. TelegramGuard uses a **three-step method** for risky topics:
50
 
51
- | Step | What happens |
52
- |------|-------------|
53
- | **Insider Risks** | Shares what actually goes wrong: scams, traps, how people get burned |
54
- | **Reality Check** | Asks if you're curious or serious, no judgment |
55
- | **Direction** | If you persist, gives enough info to stay safe |
56
 
57
- This isn't a compliance bot. It's a street-smart friend who's seen things.
 
 
 
58
 
59
- Built on [**I-Lang Prompt Spec**](https://ilang.ai), a structured protocol that programs AI behavior using genetic code. The bot's personality lives in `.ilang` files with GENE definitions, IMMUNE response patterns, and a layered SOUL/PUBLIC architecture.
60
 
61
  ---
62
 
63
- ## Features
 
 
64
 
65
- **Anti-Spam** — AI-powered three-step analysis. Detects ads, scams, crypto spam, sexual content, political propaganda. Sees through Unicode tricks, emoji stuffing, and homophone substitution. Catches repeat flooding without AI (pure logic, zero token cost). Bans spammers and deletes all their recent messages in parallel.
66
 
67
- **Vision** — Reads images using three-step image analysis: inventory everything in the image, find the subtext, deliver the insight. Catches image-based spam too. Understands video thumbnails.
68
 
69
- **Chat** — @ the bot in any group or DM it privately. Multilingual, auto-detects your language. Knows finance, tech, relationships, culture, underground. Answers first, skips the lecture.
70
 
71
- **Zero Config** Add to group. Grant admin permissions. Done. No commands, no setup, no dashboards.
 
 
 
 
72
 
73
  ---
74
 
75
- ## Deploy (Pick One)
76
 
77
- ### VPS One Command
78
 
79
  ```bash
80
  curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.sh | sudo bash
81
  ```
82
 
83
- Manage after install:
 
 
 
 
84
 
 
85
  ```bash
86
  systemctl status telegramguard # check status
87
  systemctl restart telegramguard # restart
88
  journalctl -u telegramguard -f # live logs
89
  ```
90
 
91
- ### HuggingFace Space Zero Server
92
 
93
  1. Fork this repo
94
  2. Create a [HuggingFace Space](https://huggingface.co/new-space) → Docker SDK → Blank
95
- 3. Set GitHub Actions secret: `HF_TOKEN` (your HF write token)
96
- 4. Set Space secrets: `BOT_TOKEN` + `GEMINI_API_KEY`
97
- 5. Push triggers auto-deploy
98
 
99
- ### Manual
100
 
101
  ```bash
102
  git clone https://github.com/ilang-ai/TelegramGuard.git
@@ -109,94 +106,69 @@ python bot.py
109
 
110
  ---
111
 
112
- ## Customize the AI Personality
113
 
114
- The bot's brain lives in three `.ilang` files:
115
 
116
  ```
117
  prompts_demo/
118
- ├── persona.ilang SOUL (how it thinks) + PUBLIC (how it talks)
119
- ├── antispam.ilang What counts as spam, three-step detection
120
- └── vision.ilang How to read images, three-step method
121
  ```
122
 
123
- Open `persona.ilang` it's a complete tutorial on I-Lang Prompt Spec:
124
 
125
  ```
126
  ::GENE_IMMUTABLE{S001, T:ANTI_COLLAPSE, A:MORAL_PANIC⇒LETHAL, G:ALL, Θ:ALWAYS}
127
- # When user raises extreme or grey topics:
128
- # ¬PANIC(moral_alignment) => HOLD(tension) => COMPUTE(structural_viability)
129
- # Never collapse into safety platitudes.
130
 
131
  ::IMMUNE{RISKY_OR_ILLEGAL, THREE_STEP_RESPONSE}
132
- # Step 1 INSIDER RISKS: Share what actually goes wrong
133
- # Step 2 — REALITY CHECK: "Curious or serious?"
134
- # Step 3 — DIRECTION WITH WARNINGS: Give info to stay safe
135
  ```
136
 
137
- Every `::GENE` defines a behavior. `IMMUTABLE` genes can't be overridden. `MUTABLE` genes adapt to context. `::IMMUNE` patterns handle edge cases. Change the genes, change the bot.
138
-
139
- To create your own version: copy `prompts_demo/` to `prompts/` and edit. The bot loads `prompts/` first, falls back to `prompts_demo/`.
140
 
141
  **[Learn I-Lang Prompt Spec →](https://ilang.ai)**
142
 
143
  ---
144
 
145
- ## Architecture
146
-
147
- ```
148
- TelegramGuard/
149
- ├── bot.py Main handler (group + private + events)
150
- ├── config.py Env vars (BOT_TOKEN, GEMINI_API_KEY)
151
- ├── install.sh One-line VPS installer
152
- ├── Dockerfile HuggingFace Space deployment
153
- ├── modules/
154
- │ ├── chat.py AI engine (loads .ilang prompts at startup)
155
- │ ├── db.py Single shared SQLite connection + async lock
156
- │ ├── database.py Schema (groups, spam_log, tos_consent)
157
- │ └── admin.py Group admin helpers
158
- └── prompts_demo/ AI personality in I-Lang Prompt Spec
159
- ├── persona.ilang SOUL + PUBLIC + PROPAGATION layers
160
- ├── antispam.ilang Three-step spam detection
161
- └── vision.ilang Three-step image reading
162
- ```
163
-
164
- ---
165
-
166
  ## BotFather Setup
167
 
168
- After creating your bot with [@BotFather](https://t.me/BotFather):
169
 
170
  ```
171
- /setjoingroups → Enable (allow adding to groups)
172
- /setprivacy → Disable (bot can see all group messages for anti-spam)
173
  ```
174
 
175
  ---
176
 
177
- ## Tech Stack
178
 
179
- | Component | Choice | Why |
180
- |-----------|--------|-----|
181
- | Runtime | Python 3.11 | Async, universal |
182
- | AI | Gemini 2.5 Flash | Free tier, fast, vision capable |
183
- | Database | SQLite + async lock | Zero setup, single file |
184
- | Prompts | I-Lang Prompt Spec | Structured > natural language |
185
- | Deploy | Docker / systemd | HF Space or any VPS |
 
 
 
 
 
 
186
 
187
  ---
188
 
189
  <div align="center">
190
 
191
- **[I-Lang Prompt Spec](https://ilang.ai)** — Structured AI instructions using genetic code.
192
-
193
- GENE framework. IMMUNE patterns. SOUL/PUBLIC layers.
194
-
195
- One `.ilang` file defines an entire AI personality.
196
 
197
- [![GitHub](https://img.shields.io/badge/spec-ilang--ai/ilang--spec-black?logo=github)](https://github.com/ilang-ai/ilang-spec)
198
- [![Website](https://img.shields.io/badge/web-ilang.ai-blue)](https://ilang.ai)
199
- [![HuggingFace](https://img.shields.io/badge/HF-i--Lang-yellow?logo=huggingface)](https://huggingface.co/i-Lang)
200
 
201
  MIT | [Eastsoft Inc.](https://eastsoft.com) | [I-Lang Research](https://research.ilang.ai)
202
 
 
23
 
24
  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
25
  [![Powered by I-Lang](https://img.shields.io/badge/powered%20by-I--Lang%20Spec-blueviolet)](https://ilang.ai)
 
26
  [![Gemini](https://img.shields.io/badge/AI-Gemini%202.5%20Flash-4285F4)](https://aistudio.google.com)
27
 
28
+ **[English](README.md)** | **[中文](README_CN.md)**
 
 
 
 
 
 
 
 
29
 
30
+ </div>
 
 
 
 
31
 
32
  ---
33
 
34
+ ## Use It Now (Zero Setup)
35
 
36
+ Add the official bot to your Telegram group. No install, no config, no cost.
37
 
38
+ **[@iLangGuardBot](https://t.me/iLangGuardBot)**
 
 
 
 
39
 
40
+ 1. Open Telegram, search `@iLangGuardBot`
41
+ 2. Add it to your group
42
+ 3. Grant admin permissions (delete messages + ban users)
43
+ 4. Done. Spam protection is automatic.
44
 
45
+ You can also DM the bot directly for AI chat.
46
 
47
  ---
48
 
49
+ ## What It Does
50
+
51
+ **Anti-Spam** — AI three-step analysis detects ads, scams, crypto spam, porn, political propaganda. Sees through Unicode tricks, emoji stuffing, homophone substitution. Catches repeat flooding (same message 3+ times) with zero AI cost. Bans and deletes all recent messages in parallel.
52
 
53
+ **Vision** — Reads images and video thumbnails. Catches image spam. In chat mode, analyzes what's really happening in a photo, not just describing objects.
54
 
55
+ **Chat** — @ the bot in any group or DM privately. Multilingual, auto-detects your language. Finance, tech, relationships, culture, anything. Answers first, lectures never.
56
 
57
+ **Three-Step Method for Sensitive Topics** Most bots refuse. TelegramGuard uses a different approach:
58
 
59
+ | Step | What happens |
60
+ |------|-------------|
61
+ | **Insider Risks** | Shares what actually goes wrong: scams, traps, consequences |
62
+ | **Reality Check** | Asks if you're curious or serious, no judgment |
63
+ | **Direction** | Gives enough info to make smart decisions |
64
 
65
  ---
66
 
67
+ ## Host Your Own
68
 
69
+ ### Option 1: VPS (One Command)
70
 
71
  ```bash
72
  curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.sh | sudo bash
73
  ```
74
 
75
+ The script handles everything: clone, dependencies, token setup, systemd service, auto-start.
76
+
77
+ You need two things (both free):
78
+ - **Bot Token** — open Telegram → [@BotFather](https://t.me/BotFather) → `/newbot`
79
+ - **Gemini API Key** — [aistudio.google.com/apikey](https://aistudio.google.com/apikey)
80
 
81
+ After install:
82
  ```bash
83
  systemctl status telegramguard # check status
84
  systemctl restart telegramguard # restart
85
  journalctl -u telegramguard -f # live logs
86
  ```
87
 
88
+ ### Option 2: HuggingFace Space (Free, No Server)
89
 
90
  1. Fork this repo
91
  2. Create a [HuggingFace Space](https://huggingface.co/new-space) → Docker SDK → Blank
92
+ 3. GitHub repo Settings → Secrets → add `HF_TOKEN` (your HF write token)
93
+ 4. HF Space Settings → Secrets → add `BOT_TOKEN` + `GEMINI_API_KEY`
94
+ 5. Push to GitHub triggers auto-deploy to HF
95
 
96
+ ### Option 3: Manual
97
 
98
  ```bash
99
  git clone https://github.com/ilang-ai/TelegramGuard.git
 
106
 
107
  ---
108
 
109
+ ## Customize the AI
110
 
111
+ The bot's brain lives in `.ilang` files using [I-Lang Prompt Spec](https://ilang.ai):
112
 
113
  ```
114
  prompts_demo/
115
+ ├── persona.ilang How it thinks + how it talks
116
+ ├── antispam.ilang What counts as spam
117
+ └── vision.ilang How it reads images
118
  ```
119
 
120
+ Each file contains `::GENE` definitions that control behavior:
121
 
122
  ```
123
  ::GENE_IMMUTABLE{S001, T:ANTI_COLLAPSE, A:MORAL_PANIC⇒LETHAL, G:ALL, Θ:ALWAYS}
124
+ # When user raises grey topics: don't panic, analyze objectively.
 
 
125
 
126
  ::IMMUNE{RISKY_OR_ILLEGAL, THREE_STEP_RESPONSE}
127
+ # Step 1: Insider risks Step 2: Reality check Step 3: Direction
 
 
128
  ```
129
 
130
+ Change the genes, change the bot. To customize: copy `prompts_demo/` to `prompts/`, edit. The bot loads `prompts/` first.
 
 
131
 
132
  **[Learn I-Lang Prompt Spec →](https://ilang.ai)**
133
 
134
  ---
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  ## BotFather Setup
137
 
138
+ After creating your bot, send to [@BotFather](https://t.me/BotFather):
139
 
140
  ```
141
+ /setjoingroups → Enable
142
+ /setprivacy → Disable
143
  ```
144
 
145
  ---
146
 
147
+ ## Architecture
148
 
149
+ ```
150
+ TelegramGuard/
151
+ ├── bot.py Core (group + private + events)
152
+ ├── config.py Env vars
153
+ ├── install.sh One-line VPS installer
154
+ ├── Dockerfile HF Space deployment
155
+ ├── modules/
156
+ │ ├── chat.py AI engine (loads .ilang prompts)
157
+ │ ├── db.py Shared SQLite + async lock
158
+ │ ├── database.py Schema
159
+ │ └── admin.py Group admin
160
+ └── prompts_demo/ AI personality (.ilang files)
161
+ ```
162
 
163
  ---
164
 
165
  <div align="center">
166
 
167
+ Built with **[I-Lang Prompt Spec](https://ilang.ai)** — structured AI instructions using genetic code.
 
 
 
 
168
 
169
+ [![Spec](https://img.shields.io/badge/spec-ilang--ai/ilang--spec-black?logo=github)](https://github.com/ilang-ai/ilang-spec)
170
+ [![Web](https://img.shields.io/badge/web-ilang.ai-blue)](https://ilang.ai)
171
+ [![HF](https://img.shields.io/badge/HF-i--Lang-yellow?logo=huggingface)](https://huggingface.co/i-Lang)
172
 
173
  MIT | [Eastsoft Inc.](https://eastsoft.com) | [I-Lang Research](https://research.ilang.ai)
174
 
README_CN.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # 🛡️ TelegramGuard
4
+
5
+ **真正回答问题的AI群管机器人**
6
+
7
+ 反垃圾 · 看图识别 · 智能对话 · 知无不答
8
+
9
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
+ [![Powered by I-Lang](https://img.shields.io/badge/powered%20by-I--Lang%20Spec-blueviolet)](https://ilang.ai)
11
+ [![Gemini](https://img.shields.io/badge/AI-Gemini%202.5%20Flash-4285F4)](https://aistudio.google.com)
12
+
13
+ **[English](README.md)** | **[中文](README_CN.md)**
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 直接使用(零成本零配置)
20
+
21
+ 把官方机器人拉进你的电报群, 立刻开始工作。不需要安装, 不需要服务器, 不花一分钱。
22
+
23
+ **[@iLangGuardBot](https://t.me/iLangGuardBot)**
24
+
25
+ 1. 打开电报, 搜索 `@iLangGuardBot`
26
+ 2. 把它加到你的群里
27
+ 3. 给管理员权限(删消息 + 封人)
28
+ 4. 完事。反垃圾全自动。
29
+
30
+ 也可以直接私聊机器人, 什么都能问。
31
+
32
+ ---
33
+
34
+ ## 它能做什么
35
+
36
+ **反垃圾** — AI三步分析, 识别广告、诈骗、加密货币spam、色情、政治宣传。能看穿Unicode变体、emoji混淆、谐音替代等花招。相同消息刷屏3次自动判定, 零AI成本。封人+删除全部近期消息, 并行执行。
37
+
38
+ **看图** — 识别图片和视频缩略图。拦截图片类垃圾信息。聊天模式下, 分析照片背后真正发生了什么, 不是干巴巴描述物体。
39
+
40
+ **聊天** — 在群里@它或者私聊。自动检测语言, 用你的语言回复。金融、技术、感情、文化, 什么都聊。先回答, 不说教。
41
+
42
+ **敏感话题三步法** — 别的机器人直接拒绝, TelegramGuard不一样:
43
+
44
+ | 步骤 | 做什么 |
45
+ |------|--------|
46
+ | **风险揭底** | 像老江湖一样告诉你这里面的坑: 骗局、陷阱、后果 |
47
+ | **确认意图** | 问你是好奇还是认真的, 不带评判 |
48
+ | **给方向** | 给足够的信息让你做聪明的决定 |
49
+
50
+ ---
51
+
52
+ ## 自己部署
53
+
54
+ ### 方式一: VPS一键安装
55
+
56
+ ```bash
57
+ curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.sh | sudo bash
58
+ ```
59
+
60
+ 一行命令搞定: 下载代码、装依赖、填token、创建系统服务、自动启动。
61
+
62
+ 你需要准备两样东西(都免费):
63
+ - **Bot Token** — 打开电报 → 找 [@BotFather](https://t.me/BotFather) → 发 `/newbot`
64
+ - **Gemini API Key** — 去 [aistudio.google.com/apikey](https://aistudio.google.com/apikey) 免费申请
65
+
66
+ 装完后管理:
67
+ ```bash
68
+ systemctl status telegramguard # 看状态
69
+ systemctl restart telegramguard # 重启
70
+ journalctl -u telegramguard -f # 看日志
71
+ ```
72
+
73
+ ### 方式二: HuggingFace Space(免费, 不需要服务器)
74
+
75
+ 1. Fork 这个仓库
76
+ 2. 创建 [HuggingFace Space](https://huggingface.co/new-space) → Docker SDK → Blank
77
+ 3. GitHub仓库 Settings → Secrets → 加 `HF_TOKEN`
78
+ 4. HF Space Settings → Secrets → 加 `BOT_TOKEN` + `GEMINI_API_KEY`
79
+ 5. 推代码自动部署
80
+
81
+ ### 方式三: 手动
82
+
83
+ ```bash
84
+ git clone https://github.com/ilang-ai/TelegramGuard.git
85
+ cd TelegramGuard
86
+ pip install -r requirements.txt
87
+ export BOT_TOKEN="你的token"
88
+ export GEMINI_API_KEY="你的key"
89
+ python bot.py
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 自定义AI人格
95
+
96
+ 机器人的大脑是三个 `.ilang` 文件, 使用 [I-Lang Prompt Spec](https://ilang.ai) 编写:
97
+
98
+ ```
99
+ prompts_demo/
100
+ ├── persona.ilang 思维方式 + 说话方式
101
+ ├── antispam.ilang 什么算垃圾信息
102
+ └── vision.ilang 怎么看图
103
+ ```
104
+
105
+ 每个文件里的 `::GENE` 定义一个行为:
106
+
107
+ ```
108
+ ::GENE_IMMUTABLE{S001, T:ANTI_COLLAPSE, A:MORAL_PANIC⇒LETHAL, G:ALL, Θ:ALWAYS}
109
+ # 用户问敏感话题时: 不慌, 客观分析
110
+
111
+ ::IMMUNE{RISKY_OR_ILLEGAL, THREE_STEP_RESPONSE}
112
+ # 第一步: 揭底风险 第二步: 确认意图 第三步: 给方向
113
+ ```
114
+
115
+ 改基因 = 改机器人。想自定义: 复制 `prompts_demo/` 到 `prompts/`, 然后编辑。机器人优先加载 `prompts/`。
116
+
117
+ **[学习 I-Lang Prompt Spec →](https://ilang.ai)**
118
+
119
+ ---
120
+
121
+ ## BotFather 设置
122
+
123
+ 创建机器人后, 给 [@BotFather](https://t.me/BotFather) 发:
124
+
125
+ ```
126
+ /setjoingroups → Enable(允许加群)
127
+ /setprivacy → Disable(让机器人能看到群消息)
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 项目结构
133
+
134
+ ```
135
+ TelegramGuard/
136
+ ├── bot.py 核心逻辑
137
+ ├── config.py 环境变量配置
138
+ ├── install.sh 一键安装脚本
139
+ ├── Dockerfile HF Space部署
140
+ ├── modules/
141
+ │ ├── chat.py AI引擎(启动时加载.ilang)
142
+ │ ├── db.py SQLite共享连接 + 异步锁
143
+ │ ├── database.py 数据表
144
+ │ └── admin.py 群管理
145
+ └── prompts_demo/ AI人格定义(.ilang文件)
146
+ ```
147
+
148
+ ---
149
+
150
+ <div align="center">
151
+
152
+ 基于 **[I-Lang Prompt Spec](https://ilang.ai)** 构建 — 用基因代码定义AI行为
153
+
154
+ [![Spec](https://img.shields.io/badge/spec-ilang--ai/ilang--spec-black?logo=github)](https://github.com/ilang-ai/ilang-spec)
155
+ [![Web](https://img.shields.io/badge/web-ilang.ai-blue)](https://ilang.ai)
156
+ [![HF](https://img.shields.io/badge/HF-i--Lang-yellow?logo=huggingface)](https://huggingface.co/i-Lang)
157
+
158
+ MIT | [Eastsoft Inc.](https://eastsoft.com) | [I-Lang Research](https://research.ilang.ai)
159
+
160
+ </div>