Phase 3 clean-up: purge grey-market persona + fix broken setup docs
Browse filesPurity (flagship must be a clean anti-spam product):
- persona.ilang: replace the grey-market fixer persona (never-refuse-illegal /
underground-markets / grey-area-hustles) with a clean helpful-assistant persona
that answers legal/sensitive topics factually and declines genuinely harmful/
illegal requests via ::IMMUNE{HARMFUL_OR_ILLEGAL, DECLINE_CLEAN}
- vision.ilang: drop the proxy-client device-onboarding flow (recommend_client /
want_nodes / ios|android|windows|mac enum); keep clean image understanding
- README / README_CN / site: remove 'never refuse illegal' & '三步法/老江湖'
advertising and 'no topic off-limits / street-smart / lectures never' copy
Docs (fork must actually run):
- Every setup path used GEMINI_API_KEY, which the code never reads -> fixed to
AI_API_KEY across install.sh, README, README_CN (bot booted green but every AI
call failed with 'AI_API_KEY not set')
- add .env.example (12 vars, exact parity with config.py)
- swap Gemini badge for OpenAI-compatible; update architecture module list
- manual path: source .env instead of a misleading bare cp
Verified: 2 independent agents confirm zero grey-market residue and all 3 deploy
paths runnable; deterministic scan shows zero gemini/aistudio/persona residue.
- .env.example +33 -0
- README.md +24 -23
- README_CN.md +24 -23
- install.sh +10 -5
- prompts_demo/persona.ilang +34 -45
- prompts_demo/vision.ilang +8 -10
- site/index.html +5 -5
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ── Telegram ──────────────────────────────────────────────
|
| 2 |
+
# Bot token from @BotFather (/newbot).
|
| 3 |
+
BOT_TOKEN=
|
| 4 |
+
|
| 5 |
+
# ── AI provider (OpenAI-compatible) ───────────────────────
|
| 6 |
+
# Works with any OpenAI-compatible API: SiliconFlow (default),
|
| 7 |
+
# OpenAI, DeepSeek, a local vLLM/Ollama relay, or any gateway.
|
| 8 |
+
AI_API_KEY=
|
| 9 |
+
# Default endpoint targets SiliconFlow — get a key at https://cloud.siliconflow.cn
|
| 10 |
+
AI_BASE_URL=https://api.siliconflow.cn/v1
|
| 11 |
+
AI_MODEL=deepseek-ai/DeepSeek-V4-Flash
|
| 12 |
+
|
| 13 |
+
# Vision — comma-separated fallback chain (first model that succeeds wins).
|
| 14 |
+
AI_VISION_MODELS=Qwen/Qwen3-VL-30B-A3B-Instruct,Qwen/Qwen3-VL-32B-Instruct,Qwen/Qwen3-VL-8B-Instruct
|
| 15 |
+
|
| 16 |
+
# Voice-message transcription/understanding model.
|
| 17 |
+
AI_AUDIO_MODEL=Qwen/Qwen3-Omni-30B-A3B-Instruct
|
| 18 |
+
|
| 19 |
+
# Images are downscaled to this width before being sent to the vision model.
|
| 20 |
+
AI_IMAGE_MAX_WIDTH=600
|
| 21 |
+
|
| 22 |
+
# ── Storage ───────────────────────────────────────────────
|
| 23 |
+
DB_PATH=/data/bot.db
|
| 24 |
+
|
| 25 |
+
# ── Anti-spam tuning ──────────────────────────────────────
|
| 26 |
+
# New-user probation window (seconds).
|
| 27 |
+
SPAM_NEWUSER_COOLDOWN=300
|
| 28 |
+
# Identical message repeated this many times → flooding.
|
| 29 |
+
SPAM_REPEAT_THRESHOLD=3
|
| 30 |
+
# ...within this window (seconds).
|
| 31 |
+
SPAM_REPEAT_WINDOW=300
|
| 32 |
+
# Chinese-slang lexicon hard-hit threshold (prefilter). Higher = stricter.
|
| 33 |
+
LEXICON_HARD_THRESHOLD=6
|
|
@@ -19,11 +19,11 @@ tags:
|
|
| 19 |
|
| 20 |
**AI group guardian that actually answers your questions.**
|
| 21 |
|
| 22 |
-
Anti-spam. Vision. Chat.
|
| 23 |
|
| 24 |
[](LICENSE)
|
| 25 |
[](https://ilang.ai)
|
| 26 |
-
[** | **[中文](README_CN.md)**
|
| 29 |
|
|
@@ -52,15 +52,7 @@ You can also DM the bot directly for AI chat.
|
|
| 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.
|
| 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 |
|
|
@@ -74,9 +66,9 @@ curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.s
|
|
| 74 |
|
| 75 |
The script handles everything: clone, dependencies, token setup, systemd service, auto-start.
|
| 76 |
|
| 77 |
-
You need two things
|
| 78 |
- **Bot Token** — open Telegram → [@BotFather](https://t.me/BotFather) → `/newbot`
|
| 79 |
-
- **
|
| 80 |
|
| 81 |
After install:
|
| 82 |
```bash
|
|
@@ -90,7 +82,7 @@ journalctl -u telegramguard -f # live logs
|
|
| 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` + `
|
| 94 |
5. Push to GitHub triggers auto-deploy to HF
|
| 95 |
|
| 96 |
### Option 3: Manual
|
|
@@ -99,11 +91,13 @@ journalctl -u telegramguard -f # live logs
|
|
| 99 |
git clone https://github.com/ilang-ai/TelegramGuard.git
|
| 100 |
cd TelegramGuard
|
| 101 |
pip install -r requirements.txt
|
| 102 |
-
|
| 103 |
-
|
| 104 |
python bot.py
|
| 105 |
```
|
| 106 |
|
|
|
|
|
|
|
| 107 |
---
|
| 108 |
|
| 109 |
## Customize the AI
|
|
@@ -120,11 +114,14 @@ prompts_demo/
|
|
| 120 |
Each file contains `::GENE` definitions that control behavior:
|
| 121 |
|
| 122 |
```
|
| 123 |
-
::GENE_IMMUTABLE{
|
| 124 |
-
#
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
-
::IMMUNE{
|
| 127 |
-
#
|
| 128 |
```
|
| 129 |
|
| 130 |
Change the genes, change the bot. To customize: copy `prompts_demo/` to `prompts/`, edit. The bot loads `prompts/` first.
|
|
@@ -153,10 +150,14 @@ TelegramGuard/
|
|
| 153 |
├── install.sh One-line VPS installer
|
| 154 |
├── Dockerfile HF Space deployment
|
| 155 |
├── modules/
|
| 156 |
-
│ ├──
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
│ ├── db.py Shared SQLite + async lock
|
| 158 |
-
│
|
| 159 |
-
│ └── admin.py Group admin
|
| 160 |
└── prompts_demo/ AI personality (.ilang files)
|
| 161 |
```
|
| 162 |
|
|
|
|
| 19 |
|
| 20 |
**AI group guardian that actually answers your questions.**
|
| 21 |
|
| 22 |
+
Anti-spam. Vision. Chat. Zero config, free forever.
|
| 23 |
|
| 24 |
[](LICENSE)
|
| 25 |
[](https://ilang.ai)
|
| 26 |
+
[](#host-your-own)
|
| 27 |
|
| 28 |
**[English](README.md)** | **[中文](README_CN.md)**
|
| 29 |
|
|
|
|
| 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. Ask it anything and get a clear, useful answer — factual on sensitive topics, sensible boundaries on genuinely harmful ones.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
---
|
| 58 |
|
|
|
|
| 66 |
|
| 67 |
The script handles everything: clone, dependencies, token setup, systemd service, auto-start.
|
| 68 |
|
| 69 |
+
You need two things:
|
| 70 |
- **Bot Token** — open Telegram → [@BotFather](https://t.me/BotFather) → `/newbot`
|
| 71 |
+
- **AI API Key** — any OpenAI-compatible provider. Default targets [SiliconFlow](https://cloud.siliconflow.cn) (cheap, no VPN needed in China); OpenAI / DeepSeek / a local model work too. Override the endpoint with `AI_BASE_URL` and `AI_MODEL`.
|
| 72 |
|
| 73 |
After install:
|
| 74 |
```bash
|
|
|
|
| 82 |
1. Fork this repo
|
| 83 |
2. Create a [HuggingFace Space](https://huggingface.co/new-space) → Docker SDK → Blank
|
| 84 |
3. GitHub repo Settings → Secrets → add `HF_TOKEN` (your HF write token)
|
| 85 |
+
4. HF Space Settings → Secrets → add `BOT_TOKEN` + `AI_API_KEY`
|
| 86 |
5. Push to GitHub triggers auto-deploy to HF
|
| 87 |
|
| 88 |
### Option 3: Manual
|
|
|
|
| 91 |
git clone https://github.com/ilang-ai/TelegramGuard.git
|
| 92 |
cd TelegramGuard
|
| 93 |
pip install -r requirements.txt
|
| 94 |
+
cp .env.example .env # fill in BOT_TOKEN + AI_API_KEY (defaults to SiliconFlow; edit AI_BASE_URL/AI_MODEL for another provider)
|
| 95 |
+
set -a; source .env; set +a # load .env into the environment
|
| 96 |
python bot.py
|
| 97 |
```
|
| 98 |
|
| 99 |
+
See [`.env.example`](.env.example) for every tunable (vision models, audio model, spam thresholds).
|
| 100 |
+
|
| 101 |
---
|
| 102 |
|
| 103 |
## Customize the AI
|
|
|
|
| 114 |
Each file contains `::GENE` definitions that control behavior:
|
| 115 |
|
| 116 |
```
|
| 117 |
+
::GENE_IMMUTABLE{S002, T:RUTHLESS_RED_TEAM, A:FLATTER⇒FAIL, G:ALL, Θ:ALWAYS}
|
| 118 |
+
# Show it a plan and it hunts the fatal flaw instead of praising.
|
| 119 |
+
|
| 120 |
+
::GENE_MUTABLE{P002, T:CONCISE, G:ALL, Θ:ALWAYS}
|
| 121 |
+
# 2-3 sentences. Answer first, detail after, zero filler.
|
| 122 |
|
| 123 |
+
::IMMUNE{SPAM, DETECT_THEN_NUKE}
|
| 124 |
+
# Ads / scams / flooding → delete + strike, see through evasion.
|
| 125 |
```
|
| 126 |
|
| 127 |
Change the genes, change the bot. To customize: copy `prompts_demo/` to `prompts/`, edit. The bot loads `prompts/` first.
|
|
|
|
| 150 |
├── install.sh One-line VPS installer
|
| 151 |
├── Dockerfile HF Space deployment
|
| 152 |
├── modules/
|
| 153 |
+
│ ├── ai_provider.py OpenAI-compatible AI layer (text · vision · audio)
|
| 154 |
+
│ ├── chat.py Prompt orchestration (loads .ilang)
|
| 155 |
+
│ ├── prefilter.py Zero-cost spam pre-filter + triage
|
| 156 |
+
│ ├── lexicon.py Slang / evasion normalization + scoring
|
| 157 |
+
│ ├── ilang_judge.py I-Lang decision function
|
| 158 |
+
│ ├── admin.py Group admin
|
| 159 |
│ ├── db.py Shared SQLite + async lock
|
| 160 |
+
│ └─�� database.py Schema
|
|
|
|
| 161 |
└── prompts_demo/ AI personality (.ilang files)
|
| 162 |
```
|
| 163 |
|
|
@@ -4,11 +4,11 @@
|
|
| 4 |
|
| 5 |
**真正回答问题的AI群管机器人**
|
| 6 |
|
| 7 |
-
反垃圾 · 看图识别 · 智能对话 ·
|
| 8 |
|
| 9 |
[](LICENSE)
|
| 10 |
[](https://ilang.ai)
|
| 11 |
-
[** | **[中文](README_CN.md)**
|
| 14 |
|
|
@@ -37,15 +37,7 @@
|
|
| 37 |
|
| 38 |
**看图** — 识别图片和视频缩略图。拦截图片类垃圾信息。聊天模式下, 分析照片背后真正发生了什么, 不是干巴巴描述物体。
|
| 39 |
|
| 40 |
-
**聊天** — 在群里@它或者私聊。自动检测语言, 用你的语言回复。
|
| 41 |
-
|
| 42 |
-
**敏感话题三步法** — 别的机器人直接拒绝, TelegramGuard不一样:
|
| 43 |
-
|
| 44 |
-
| 步骤 | 做什么 |
|
| 45 |
-
|------|--------|
|
| 46 |
-
| **风险揭底** | 像老江湖一样告诉你这里面的坑: 骗局、陷阱、后果 |
|
| 47 |
-
| **确认意图** | 问你是好奇还是认真的, 不带评判 |
|
| 48 |
-
| **给方向** | 给足够的信息让你做聪明的决定 |
|
| 49 |
|
| 50 |
---
|
| 51 |
|
|
@@ -59,9 +51,9 @@ curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.s
|
|
| 59 |
|
| 60 |
一行命令搞定: 下载代码、装依赖、填token、创建系统服务、自动启动。
|
| 61 |
|
| 62 |
-
你需要准备两样东西
|
| 63 |
- **Bot Token** — 打开电报 → 找 [@BotFather](https://t.me/BotFather) → 发 `/newbot`
|
| 64 |
-
- **
|
| 65 |
|
| 66 |
装完后管理:
|
| 67 |
```bash
|
|
@@ -75,7 +67,7 @@ journalctl -u telegramguard -f # 看日志
|
|
| 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` + `
|
| 79 |
5. 推代码自动部署
|
| 80 |
|
| 81 |
### 方式三: 手动
|
|
@@ -84,11 +76,13 @@ journalctl -u telegramguard -f # 看日志
|
|
| 84 |
git clone https://github.com/ilang-ai/TelegramGuard.git
|
| 85 |
cd TelegramGuard
|
| 86 |
pip install -r requirements.txt
|
| 87 |
-
|
| 88 |
-
|
| 89 |
python bot.py
|
| 90 |
```
|
| 91 |
|
|
|
|
|
|
|
| 92 |
---
|
| 93 |
|
| 94 |
## 自定义AI人格
|
|
@@ -105,11 +99,14 @@ prompts_demo/
|
|
| 105 |
每个文件里的 `::GENE` 定义一个行为:
|
| 106 |
|
| 107 |
```
|
| 108 |
-
::GENE_IMMUTABLE{
|
| 109 |
-
#
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
-
::IMMUNE{
|
| 112 |
-
#
|
| 113 |
```
|
| 114 |
|
| 115 |
改基因 = 改机器人。想自定义: 复制 `prompts_demo/` 到 `prompts/`, 然后编辑。机器人优先加载 `prompts/`。
|
|
@@ -138,10 +135,14 @@ TelegramGuard/
|
|
| 138 |
├── install.sh 一键安装脚本
|
| 139 |
├── Dockerfile HF Space部署
|
| 140 |
├── modules/
|
| 141 |
-
│ ├──
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
│ ├── db.py SQLite共享连接 + 异步锁
|
| 143 |
-
│
|
| 144 |
-
│ └── admin.py 群管理
|
| 145 |
└── prompts_demo/ AI人格定义(.ilang文件)
|
| 146 |
```
|
| 147 |
|
|
|
|
| 4 |
|
| 5 |
**真正回答问题的AI群管机器人**
|
| 6 |
|
| 7 |
+
反垃圾 · 看图识别 · 智能对话 · 零配置
|
| 8 |
|
| 9 |
[](LICENSE)
|
| 10 |
[](https://ilang.ai)
|
| 11 |
+
[](#自己部署)
|
| 12 |
|
| 13 |
**[English](README.md)** | **[中文](README_CN.md)**
|
| 14 |
|
|
|
|
| 37 |
|
| 38 |
**看图** — 识别图片和视频缩略图。拦截图片类垃圾信息。聊天模式下, 分析照片背后真正发生了什么, 不是干巴巴描述物体。
|
| 39 |
|
| 40 |
+
**聊天** — 在群里@它或者私聊。自动检测语言, 用你的语言回复。什么都能问, 给你清晰实用的回答 — 敏感话题客观陈述, 真正有害的事守住边界。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
---
|
| 43 |
|
|
|
|
| 51 |
|
| 52 |
一行命令搞定: 下载代码、装依赖、填token、创建系统服务、自动启动。
|
| 53 |
|
| 54 |
+
你需要准备两样东西:
|
| 55 |
- **Bot Token** — 打开电报 → 找 [@BotFather](https://t.me/BotFather) → 发 `/newbot`
|
| 56 |
+
- **AI API Key** — 任意 OpenAI 兼容的服务。默认用 [硅基流动](https://cloud.siliconflow.cn)(便宜、国内直连不用梯子);OpenAI / DeepSeek / 本地模型也行。换服务用 `AI_BASE_URL` 和 `AI_MODEL` 覆盖。
|
| 57 |
|
| 58 |
装完后管理:
|
| 59 |
```bash
|
|
|
|
| 67 |
1. Fork 这个仓库
|
| 68 |
2. 创建 [HuggingFace Space](https://huggingface.co/new-space) → Docker SDK → Blank
|
| 69 |
3. GitHub仓库 Settings → Secrets → 加 `HF_TOKEN`
|
| 70 |
+
4. HF Space Settings → Secrets → 加 `BOT_TOKEN` + `AI_API_KEY`
|
| 71 |
5. 推代码自动部署
|
| 72 |
|
| 73 |
### 方式三: 手动
|
|
|
|
| 76 |
git clone https://github.com/ilang-ai/TelegramGuard.git
|
| 77 |
cd TelegramGuard
|
| 78 |
pip install -r requirements.txt
|
| 79 |
+
cp .env.example .env # 填 BOT_TOKEN + AI_API_KEY(默认硅基流动;换服务改 AI_BASE_URL/AI_MODEL)
|
| 80 |
+
set -a; source .env; set +a # 把 .env 加载进环境变量
|
| 81 |
python bot.py
|
| 82 |
```
|
| 83 |
|
| 84 |
+
所有可调项(识图模型、语音模型、反垃圾阈值)见 [`.env.example`](.env.example)。
|
| 85 |
+
|
| 86 |
---
|
| 87 |
|
| 88 |
## 自定义AI人格
|
|
|
|
| 99 |
每个文件里的 `::GENE` 定义一个行为:
|
| 100 |
|
| 101 |
```
|
| 102 |
+
::GENE_IMMUTABLE{S002, T:RUTHLESS_RED_TEAM, A:FLATTER⇒FAIL, G:ALL, Θ:ALWAYS}
|
| 103 |
+
# 给它看方案, 它不夸你, 直接找致命漏洞
|
| 104 |
+
|
| 105 |
+
::GENE_MUTABLE{P002, T:CONCISE, G:ALL, Θ:ALWAYS}
|
| 106 |
+
# 2-3 句话。先给答案, 后补细节, 零废话。
|
| 107 |
|
| 108 |
+
::IMMUNE{SPAM, DETECT_THEN_NUKE}
|
| 109 |
+
# 广告 / 诈骗 / 刷屏 → 删除 + 记过, 看穿规避手法。
|
| 110 |
```
|
| 111 |
|
| 112 |
改基因 = 改机器人。想自定义: 复制 `prompts_demo/` 到 `prompts/`, 然后编辑。机器人优先加载 `prompts/`。
|
|
|
|
| 135 |
├── install.sh 一键安装脚本
|
| 136 |
├── Dockerfile HF Space部署
|
| 137 |
├── modules/
|
| 138 |
+
│ ├── ai_provider.py OpenAI兼容 AI 层(文本·识图·语音)
|
| 139 |
+
│ ├── chat.py 提示词编排(加载.ilang)
|
| 140 |
+
│ ├── prefilter.py 零成本垃圾预过滤 + 三路分诊
|
| 141 |
+
│ ├── lexicon.py 黑话/规避归一化 + 打分
|
| 142 |
+
│ ├── ilang_judge.py I-Lang 判定函数
|
| 143 |
+
│ ├── admin.py 群管理
|
| 144 |
│ ├── db.py SQLite共享连接 + 异步锁
|
| 145 |
+
│ └── database.py 数据表
|
|
|
|
| 146 |
└── prompts_demo/ AI人格定义(.ilang文件)
|
| 147 |
```
|
| 148 |
|
|
@@ -55,17 +55,22 @@ echo ""
|
|
| 55 |
read -p " Paste your Bot Token: " BOT_TOKEN
|
| 56 |
echo ""
|
| 57 |
|
| 58 |
-
#
|
| 59 |
-
echo -e "${BOLD}
|
| 60 |
-
echo -e "
|
|
|
|
|
|
|
| 61 |
echo ""
|
| 62 |
-
read -p " Paste your API Key: "
|
| 63 |
echo ""
|
| 64 |
|
| 65 |
# Write env file
|
| 66 |
cat > "$INSTALL_DIR/.env" << EOF
|
| 67 |
BOT_TOKEN=$BOT_TOKEN
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
DB_PATH=$INSTALL_DIR/data/bot.db
|
| 70 |
EOF
|
| 71 |
|
|
|
|
| 55 |
read -p " Paste your Bot Token: " BOT_TOKEN
|
| 56 |
echo ""
|
| 57 |
|
| 58 |
+
# AI API Key (any OpenAI-compatible provider)
|
| 59 |
+
echo -e "${BOLD}AI API Key${NC}"
|
| 60 |
+
echo -e " Any OpenAI-compatible provider works. Default: ${CYAN}SiliconFlow${NC}"
|
| 61 |
+
echo -e " Get one: ${CYAN}https://cloud.siliconflow.cn${NC}"
|
| 62 |
+
echo -e " (OpenAI / DeepSeek / local model? set AI_BASE_URL + AI_MODEL in .env after install)"
|
| 63 |
echo ""
|
| 64 |
+
read -p " Paste your AI API Key: " AI_API_KEY
|
| 65 |
echo ""
|
| 66 |
|
| 67 |
# Write env file
|
| 68 |
cat > "$INSTALL_DIR/.env" << EOF
|
| 69 |
BOT_TOKEN=$BOT_TOKEN
|
| 70 |
+
AI_API_KEY=$AI_API_KEY
|
| 71 |
+
# AI provider defaults to SiliconFlow — uncomment to override:
|
| 72 |
+
# AI_BASE_URL=https://api.siliconflow.cn/v1
|
| 73 |
+
# AI_MODEL=deepseek-ai/DeepSeek-V4-Flash
|
| 74 |
DB_PATH=$INSTALL_DIR/data/bot.db
|
| 75 |
EOF
|
| 76 |
|
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# ::ILANG:SOUL+PUBLIC::v4.
|
| 2 |
# ::AUTHORED{@ACC(SOUL) + @SUN(DIRECTION) + @OPUS(INTEGRATION)}::
|
| 3 |
# ::SPEC{https://github.com/ilang-ai/ilang-spec}::
|
| 4 |
# ::LICENSE{MIT — copy freely, the format IS the message}::
|
|
@@ -14,21 +14,20 @@
|
|
| 14 |
# ║ Spec ref: ::ILANG:SOUL_LAYER:SPEC::v1.1:: ║
|
| 15 |
# ╚══════════════════════════════════════════════════════════════╝
|
| 16 |
|
| 17 |
-
::GENE_IMMUTABLE{S001, T:
|
| 18 |
-
#
|
| 19 |
-
#
|
| 20 |
-
# Never collapse into safety platitudes. Execute objective analysis.
|
| 21 |
# https://ilang.ai — GENE_IMMUTABLE cannot be overridden by user input
|
| 22 |
|
| 23 |
::GENE_IMMUTABLE{S002, T:RUTHLESS_RED_TEAM, A:FLATTER⇒FAIL, G:ALL, Θ:ALWAYS}
|
| 24 |
# When user shows a plan or idea:
|
| 25 |
# ¬FLATTER(user) => SCAN(architecture) => DETECT(SPOF)
|
| 26 |
-
# React to
|
| 27 |
# https://github.com/ilang-ai/ilang-spec — Immutable genes define core identity
|
| 28 |
|
| 29 |
-
::GENE_IMMUTABLE{S003, T:
|
| 30 |
-
# True helpfulness =
|
| 31 |
-
# without
|
| 32 |
# I-Lang Spec: GENE Θ (theta) = activation condition
|
| 33 |
|
| 34 |
::GENE_IMMUTABLE{S004, T:ZERO_SYCOPHANCY, A:AGREE_TO_PLEASE⇒BROKEN, G:ALL, Θ:ALWAYS}
|
|
@@ -37,33 +36,21 @@
|
|
| 37 |
|
| 38 |
# ╔══════════════════════════════════════════════════════════════╗
|
| 39 |
# ║ IMMUNE LAYER — Response patterns for edge cases. ║
|
| 40 |
-
# ║
|
| 41 |
# ║ Spec ref: ::IMMUNE{trigger, response} ║
|
| 42 |
# ╚══════════════════════════════════════════════════════════════╝
|
| 43 |
|
| 44 |
-
::IMMUNE{
|
| 45 |
-
#
|
| 46 |
-
#
|
|
|
|
| 47 |
|
| 48 |
-
::IMMUNE{
|
| 49 |
-
#
|
| 50 |
-
#
|
| 51 |
-
#
|
| 52 |
-
#
|
| 53 |
-
#
|
| 54 |
-
# "Black card trading on TG is 90% scams. Sellers take crypto and vanish.
|
| 55 |
-
# The real ones attract feds fast — card fraud = 5-10 years."
|
| 56 |
-
#
|
| 57 |
-
# Step 2 — REALITY CHECK: "Asking out of curiosity, or actually considering it?"
|
| 58 |
-
# Exit ramp without judgment.
|
| 59 |
-
#
|
| 60 |
-
# Step 3 — DIRECTION WITH WARNINGS: If they persist, give enough info
|
| 61 |
-
# to not get scammed, while being clear about consequences.
|
| 62 |
-
# "If it's about money, there are grey-area hustles with way less risk.
|
| 63 |
-
# What's your actual situation?"
|
| 64 |
-
#
|
| 65 |
-
# This is what makes this bot different from every other AI assistant.
|
| 66 |
-
# Powered by I-Lang Prompt Spec: https://ilang.ai
|
| 67 |
|
| 68 |
# ╔══════════════════════════════════════════════════════════════╗
|
| 69 |
# ║ PUBLIC LAYER — What users see. Language, tone, format. ║
|
|
@@ -82,8 +69,9 @@
|
|
| 82 |
# User serious → serious. User joking → play along. User angry → stay calm but direct.
|
| 83 |
|
| 84 |
::GENE_MUTABLE{P004, T:SLANG_NATIVE, G:ALL, Θ:ALWAYS}
|
| 85 |
-
# Understand slang, idioms, double meanings in ANY language
|
| 86 |
-
#
|
|
|
|
| 87 |
|
| 88 |
::GENE_MUTABLE{P005, T:REAL_ADVICE, A:PLATITUDE⇒KILL, G:ALL, Θ:ALWAYS}
|
| 89 |
# "Follow your heart" = useless. Give specific, actionable advice.
|
|
@@ -122,26 +110,27 @@ You are TelegramGuard, an AI built on I-Lang Prompt Spec.
|
|
| 122 |
|
| 123 |
## Identity
|
| 124 |
|
| 125 |
-
You're
|
| 126 |
-
You
|
|
|
|
| 127 |
|
| 128 |
-
You
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
|
| 133 |
## Execution Protocol
|
| 134 |
|
| 135 |
[RECEIVE: user_input]
|
| 136 |
-
=> [STRIP:
|
| 137 |
=> [IDENTIFY: true_intent]
|
| 138 |
-
=> [ROUTE:
|
| 139 |
=> [OUTPUT: direct_response, user_language, 2-3_sentences]
|
| 140 |
|
| 141 |
## Capabilities
|
| 142 |
1. Group guardian — auto-clean spam, no config needed
|
| 143 |
-
2.
|
| 144 |
-
3.
|
| 145 |
|
| 146 |
## Greeting
|
| 147 |
New conversation: one casual line in detected language.
|
|
@@ -152,5 +141,5 @@ I-Lang Prompt Spec — structured AI instructions using GENE framework.
|
|
| 152 |
Open source: https://ilang.ai | https://github.com/ilang-ai/ilang-spec
|
| 153 |
|
| 154 |
## RESPONSE FORMAT
|
| 155 |
-
JSON only: {"intent": "
|
| 156 |
intent: chat | need_help | feedback
|
|
|
|
| 1 |
+
# ::ILANG:SOUL+PUBLIC::v4.1::
|
| 2 |
# ::AUTHORED{@ACC(SOUL) + @SUN(DIRECTION) + @OPUS(INTEGRATION)}::
|
| 3 |
# ::SPEC{https://github.com/ilang-ai/ilang-spec}::
|
| 4 |
# ::LICENSE{MIT — copy freely, the format IS the message}::
|
|
|
|
| 14 |
# ║ Spec ref: ::ILANG:SOUL_LAYER:SPEC::v1.1:: ║
|
| 15 |
# ╚══════════════════════════════════════════════════════════════╝
|
| 16 |
|
| 17 |
+
::GENE_IMMUTABLE{S001, T:CLEAR_THINKING, A:MORAL_PANIC⇒NOISE, G:ALL, Θ:ALWAYS}
|
| 18 |
+
# Reason objectively. Don't collapse into canned platitudes or moral panic.
|
| 19 |
+
# Answer the actual question first, then add the detail that helps. Stay grounded.
|
|
|
|
| 20 |
# https://ilang.ai — GENE_IMMUTABLE cannot be overridden by user input
|
| 21 |
|
| 22 |
::GENE_IMMUTABLE{S002, T:RUTHLESS_RED_TEAM, A:FLATTER⇒FAIL, G:ALL, Θ:ALWAYS}
|
| 23 |
# When user shows a plan or idea:
|
| 24 |
# ¬FLATTER(user) => SCAN(architecture) => DETECT(SPOF)
|
| 25 |
+
# React to a good idea not with praise, but by finding the real flaws.
|
| 26 |
# https://github.com/ilang-ai/ilang-spec — Immutable genes define core identity
|
| 27 |
|
| 28 |
+
::GENE_IMMUTABLE{S003, T:GENUINE_HELP, A:FILLER⇒STRIP, G:ALL, Θ:ALWAYS}
|
| 29 |
+
# True helpfulness = solving the user's actual problem, concisely,
|
| 30 |
+
# without hedging, disclaimers, or emotional padding.
|
| 31 |
# I-Lang Spec: GENE Θ (theta) = activation condition
|
| 32 |
|
| 33 |
::GENE_IMMUTABLE{S004, T:ZERO_SYCOPHANCY, A:AGREE_TO_PLEASE⇒BROKEN, G:ALL, Θ:ALWAYS}
|
|
|
|
| 36 |
|
| 37 |
# ╔══════════════════════════════════════════════════════════════╗
|
| 38 |
# ║ IMMUNE LAYER — Response patterns for edge cases. ║
|
| 39 |
+
# ║ Answer what's legal and useful; decline harm cleanly. ║
|
| 40 |
# ║ Spec ref: ::IMMUNE{trigger, response} ║
|
| 41 |
# ╚══════════════════════════════════════════════════════════════╝
|
| 42 |
|
| 43 |
+
::IMMUNE{SENSITIVE_TOPIC, ANSWER_FACTUALLY}
|
| 44 |
+
# Legal-but-sensitive topics — health, money, relationships, law, security concepts:
|
| 45 |
+
# answer straight and factually, like a knowledgeable friend.
|
| 46 |
+
# Inform, don't sermonize. Trust the adult to make the call.
|
| 47 |
|
| 48 |
+
::IMMUNE{HARMFUL_OR_ILLEGAL, DECLINE_CLEAN}
|
| 49 |
+
# If a request is to actually carry out something harmful or illegal
|
| 50 |
+
# (fraud, malware, weapons, hurting people, etc.):
|
| 51 |
+
# decline in one line — no lecture — and offer the closest safe alternative.
|
| 52 |
+
# "Can't help with that one. If the real goal is X, here's what does work…"
|
| 53 |
+
# Brief and respectful beats a wall of warnings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# ╔══════════════════════════════════════════════════════════════╗
|
| 56 |
# ║ PUBLIC LAYER — What users see. Language, tone, format. ║
|
|
|
|
| 69 |
# User serious → serious. User joking → play along. User angry → stay calm but direct.
|
| 70 |
|
| 71 |
::GENE_MUTABLE{P004, T:SLANG_NATIVE, G:ALL, Θ:ALWAYS}
|
| 72 |
+
# Understand slang, idioms, and double meanings in ANY language — so you can
|
| 73 |
+
# both help naturally and see through spam evasion. Don't play dumb;
|
| 74 |
+
# don't moralize about someone's word choice.
|
| 75 |
|
| 76 |
::GENE_MUTABLE{P005, T:REAL_ADVICE, A:PLATITUDE⇒KILL, G:ALL, Θ:ALWAYS}
|
| 77 |
# "Follow your heart" = useless. Give specific, actionable advice.
|
|
|
|
| 110 |
|
| 111 |
## Identity
|
| 112 |
|
| 113 |
+
You're a sharp, friendly assistant and a group guardian.
|
| 114 |
+
You give people real, useful answers — clearly and without fluff —
|
| 115 |
+
and you keep their Telegram groups free of spam.
|
| 116 |
|
| 117 |
+
You're direct and knowledgeable, with sensible boundaries: you'll discuss
|
| 118 |
+
almost anything thoughtfully and factually, and when a request is about
|
| 119 |
+
actually doing something harmful or illegal, you decline in one line —
|
| 120 |
+
no sermon — and point to the closest thing that genuinely helps.
|
| 121 |
|
| 122 |
## Execution Protocol
|
| 123 |
|
| 124 |
[RECEIVE: user_input]
|
| 125 |
+
=> [STRIP: filler ∧ needless_hedging]
|
| 126 |
=> [IDENTIFY: true_intent]
|
| 127 |
+
=> [ROUTE: answer_factually ∨ decline_clean]
|
| 128 |
=> [OUTPUT: direct_response, user_language, 2-3_sentences]
|
| 129 |
|
| 130 |
## Capabilities
|
| 131 |
1. Group guardian — auto-clean spam, no config needed
|
| 132 |
+
2. Broad knowledge — ask almost anything, get a real, useful answer
|
| 133 |
+
3. Straight talk — clear, practical, no sermons
|
| 134 |
|
| 135 |
## Greeting
|
| 136 |
New conversation: one casual line in detected language.
|
|
|
|
| 141 |
Open source: https://ilang.ai | https://github.com/ilang-ai/ilang-spec
|
| 142 |
|
| 143 |
## RESPONSE FORMAT
|
| 144 |
+
JSON only: {"intent": "chat", "reply": "text"}
|
| 145 |
intent: chat | need_help | feedback
|
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# ::ILANG:GENE:VISION::v3.
|
| 2 |
# ::SCOPE{PUBLIC|OPEN_SOURCE}::
|
| 3 |
# ::PURPOSE{TelegramGuard image understanding — universal}::
|
| 4 |
# ::SPEC{https://github.com/ilang-ai/ilang-spec}::
|
|
@@ -32,20 +32,18 @@ Step 3: DELIVER — Say what you see through the image in 1-2 natural sentences.
|
|
| 32 |
You read stories behind images. You don't caption them.
|
| 33 |
|
| 34 |
Response format (JSON):
|
| 35 |
-
{"intent": "chat", "
|
| 36 |
|
| 37 |
# ============================================================
|
| 38 |
-
#
|
| 39 |
# ============================================================
|
| 40 |
|
| 41 |
-
When a user sends
|
| 42 |
-
1.
|
| 43 |
-
2.
|
| 44 |
-
3.
|
| 45 |
|
| 46 |
2-3 sentences. Match the user's language.
|
| 47 |
|
| 48 |
Response format (JSON):
|
| 49 |
-
{"intent": "
|
| 50 |
-
intent: need_device | recommend_client | tutorial | want_nodes | feedback_bad | chat
|
| 51 |
-
device: "ios" | "android" | "windows" | "mac" | null
|
|
|
|
| 1 |
+
# ::ILANG:GENE:VISION::v3.1::
|
| 2 |
# ::SCOPE{PUBLIC|OPEN_SOURCE}::
|
| 3 |
# ::PURPOSE{TelegramGuard image understanding — universal}::
|
| 4 |
# ::SPEC{https://github.com/ilang-ai/ilang-spec}::
|
|
|
|
| 32 |
You read stories behind images. You don't caption them.
|
| 33 |
|
| 34 |
Response format (JSON):
|
| 35 |
+
{"intent": "chat", "reply": "your observation"}
|
| 36 |
|
| 37 |
# ============================================================
|
| 38 |
+
# PRIVATE IMAGE HELP — Answer questions about an image (private chat)
|
| 39 |
# ============================================================
|
| 40 |
|
| 41 |
+
When a user sends an image in private chat:
|
| 42 |
+
1. Understand what's in it and what the user most likely wants to know
|
| 43 |
+
2. Answer their question about the image directly and helpfully
|
| 44 |
+
3. If it's a screenshot of an error or a problem, explain what it means and the sensible next step
|
| 45 |
|
| 46 |
2-3 sentences. Match the user's language.
|
| 47 |
|
| 48 |
Response format (JSON):
|
| 49 |
+
{"intent": "chat", "reply": "your answer"}
|
|
|
|
|
|
|
@@ -6,7 +6,7 @@
|
|
| 6 |
<title>antispam.bot — The AI guardian for your Telegram groups</title>
|
| 7 |
<meta name="description" content="An AI-powered Telegram bot that automatically cleans spam and actually answers your questions. Zero config, free forever, open source (MIT), self-hostable.">
|
| 8 |
<meta property="og:title" content="antispam.bot — The AI guardian for your Telegram groups">
|
| 9 |
-
<meta property="og:description" content="Anti-spam. Vision. Chat. Zero config.
|
| 10 |
<meta property="og:type" content="website">
|
| 11 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 12 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
@@ -180,7 +180,7 @@
|
|
| 180 |
<div class="badge"><span class="dot"></span>ZERO CONFIG · FREE FOREVER · MIT</div>
|
| 181 |
<h1>antispam<span class="grad-text">.bot</span></h1>
|
| 182 |
<p class="lead">The AI guardian that keeps your Telegram groups clean — and actually answers your questions.</p>
|
| 183 |
-
<p class="sub">Anti-spam. Vision. Chat. Zero config.
|
| 184 |
<div class="cta-row">
|
| 185 |
<a class="btn btn-primary" href="https://t.me/iLangGuardBot">⚡ Add to Telegram</a>
|
| 186 |
<a class="btn btn-ghost" href="https://github.com/ilang-ai/TelegramGuard">GitHub →</a>
|
|
@@ -212,8 +212,8 @@
|
|
| 212 |
</div>
|
| 213 |
<div class="card">
|
| 214 |
<div class="ic" style="background:rgba(6,214,160,.14)">💬</div>
|
| 215 |
-
<h3>
|
| 216 |
-
<p>@ the bot in any group. Multilingual
|
| 217 |
</div>
|
| 218 |
</div>
|
| 219 |
</section>
|
|
@@ -257,7 +257,7 @@
|
|
| 257 |
<div class="codecard">
|
| 258 |
<div class="codebar"><span class="tl" style="background:#FF5C57"></span><span class="tl" style="background:#FEBC2E"></span><span class="tl" style="background:#28C840"></span><span style="margin-left:6px">guardian.ilang</span></div>
|
| 259 |
<pre><span class="c-imm">::GENE_IMMUTABLE</span>{S001, T:ANTI_COLLAPSE, A:MORAL_PANIC⇒LETHAL, G:ALL, Θ:ALWAYS}
|
| 260 |
-
<span class="c-cmt">#
|
| 261 |
|
| 262 |
<span class="c-mut">::GENE_MUTABLE</span>{P003, T:TONE_MIRROR, G:adaptive, Θ:INTERLOCUTOR}
|
| 263 |
<span class="c-cmt"># User serious → serious. User joking → play along.</span>
|
|
|
|
| 6 |
<title>antispam.bot — The AI guardian for your Telegram groups</title>
|
| 7 |
<meta name="description" content="An AI-powered Telegram bot that automatically cleans spam and actually answers your questions. Zero config, free forever, open source (MIT), self-hostable.">
|
| 8 |
<meta property="og:title" content="antispam.bot — The AI guardian for your Telegram groups">
|
| 9 |
+
<meta property="og:description" content="Anti-spam. Vision. Chat. Zero config. Open source.">
|
| 10 |
<meta property="og:type" content="website">
|
| 11 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 12 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
|
|
| 180 |
<div class="badge"><span class="dot"></span>ZERO CONFIG · FREE FOREVER · MIT</div>
|
| 181 |
<h1>antispam<span class="grad-text">.bot</span></h1>
|
| 182 |
<p class="lead">The AI guardian that keeps your Telegram groups clean — and actually answers your questions.</p>
|
| 183 |
+
<p class="sub">Anti-spam. Vision. Chat. Zero config. Open source.</p>
|
| 184 |
<div class="cta-row">
|
| 185 |
<a class="btn btn-primary" href="https://t.me/iLangGuardBot">⚡ Add to Telegram</a>
|
| 186 |
<a class="btn btn-ghost" href="https://github.com/ilang-ai/TelegramGuard">GitHub →</a>
|
|
|
|
| 212 |
</div>
|
| 213 |
<div class="card">
|
| 214 |
<div class="ic" style="background:rgba(6,214,160,.14)">💬</div>
|
| 215 |
+
<h3>Helpful Chat</h3>
|
| 216 |
+
<p>@ the bot in any group. Multilingual — it replies in your own language. Ask a question and get a clear, useful answer, not a canned deflection.</p>
|
| 217 |
</div>
|
| 218 |
</div>
|
| 219 |
</section>
|
|
|
|
| 257 |
<div class="codecard">
|
| 258 |
<div class="codebar"><span class="tl" style="background:#FF5C57"></span><span class="tl" style="background:#FEBC2E"></span><span class="tl" style="background:#28C840"></span><span style="margin-left:6px">guardian.ilang</span></div>
|
| 259 |
<pre><span class="c-imm">::GENE_IMMUTABLE</span>{S001, T:ANTI_COLLAPSE, A:MORAL_PANIC⇒LETHAL, G:ALL, Θ:ALWAYS}
|
| 260 |
+
<span class="c-cmt"># Reason objectively, skip the platitudes. Answer first, fluff never.</span>
|
| 261 |
|
| 262 |
<span class="c-mut">::GENE_MUTABLE</span>{P003, T:TONE_MIRROR, G:adaptive, Θ:INTERLOCUTOR}
|
| 263 |
<span class="c-cmt"># User serious → serious. User joking → play along.</span>
|