Spaces:
Running
Running
File size: 5,343 Bytes
a230509 957d007 9376a74 2317152 957d007 a230509 972b6f2 cc6f785 972b6f2 cc6f785 972b6f2 cc6f785 972b6f2 cc6f785 972b6f2 cc6f785 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 cc6f785 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 cc6f785 5eb88a0 cc6f785 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 5eb88a0 cc6f785 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 cc6f785 5eb88a0 cc6f785 972b6f2 cc6f785 5eb88a0 cc6f785 5eb88a0 cc6f785 972b6f2 5eb88a0 cc6f785 5eb88a0 cc6f785 972b6f2 5eb88a0 972b6f2 5eb88a0 972b6f2 | 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | ---
title: TelegramGuard
emoji: π‘οΈ
colorFrom: blue
colorTo: indigo
sdk: static
pinned: false
license: mit
tags:
- telegram
- anti-spam
- ilang
- chatbot
---
<div align="center">
# π‘οΈ TelegramGuard
**AI group guardian that actually answers your questions.**
Anti-spam. Vision. Chat. No topic off-limits.
[](LICENSE)
[](https://ilang.ai)
[](https://aistudio.google.com)
**[English](README.md)** | **[δΈζ](README_CN.md)**
</div>
---
## Use It Now (Zero Setup)
Add the official bot to your Telegram group. No install, no config, no cost.
**[@iLangGuardBot](https://t.me/iLangGuardBot)**
1. Open Telegram, search `@iLangGuardBot`
2. Add it to your group
3. Grant admin permissions (delete messages + ban users)
4. Done. Spam protection is automatic.
You can also DM the bot directly for AI chat.
---
## What It Does
**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.
**Vision** β Reads images and video thumbnails. Catches image spam. In chat mode, analyzes what's really happening in a photo, not just describing objects.
**Chat** β @ the bot in any group or DM privately. Multilingual, auto-detects your language. Finance, tech, relationships, culture, anything. Answers first, lectures never.
**Three-Step Method for Sensitive Topics** β Most bots refuse. TelegramGuard uses a different approach:
| Step | What happens |
|------|-------------|
| **Insider Risks** | Shares what actually goes wrong: scams, traps, consequences |
| **Reality Check** | Asks if you're curious or serious, no judgment |
| **Direction** | Gives enough info to make smart decisions |
---
## Host Your Own
### Option 1: VPS (One Command)
```bash
curl -sL https://raw.githubusercontent.com/ilang-ai/TelegramGuard/main/install.sh | sudo bash
```
The script handles everything: clone, dependencies, token setup, systemd service, auto-start.
You need two things (both free):
- **Bot Token** β open Telegram β [@BotFather](https://t.me/BotFather) β `/newbot`
- **Gemini API Key** β [aistudio.google.com/apikey](https://aistudio.google.com/apikey)
After install:
```bash
systemctl status telegramguard # check status
systemctl restart telegramguard # restart
journalctl -u telegramguard -f # live logs
```
### Option 2: HuggingFace Space (Free, No Server)
1. Fork this repo
2. Create a [HuggingFace Space](https://huggingface.co/new-space) β Docker SDK β Blank
3. GitHub repo Settings β Secrets β add `HF_TOKEN` (your HF write token)
4. HF Space Settings β Secrets β add `BOT_TOKEN` + `GEMINI_API_KEY`
5. Push to GitHub triggers auto-deploy to HF
### Option 3: Manual
```bash
git clone https://github.com/ilang-ai/TelegramGuard.git
cd TelegramGuard
pip install -r requirements.txt
export BOT_TOKEN="your-token"
export GEMINI_API_KEY="your-key"
python bot.py
```
---
## Customize the AI
The bot's brain lives in `.ilang` files using [I-Lang Prompt Spec](https://ilang.ai):
```
prompts_demo/
βββ persona.ilang How it thinks + how it talks
βββ antispam.ilang What counts as spam
βββ vision.ilang How it reads images
```
Each file contains `::GENE` definitions that control behavior:
```
::GENE_IMMUTABLE{S001, T:ANTI_COLLAPSE, A:MORAL_PANICβLETHAL, G:ALL, Ξ:ALWAYS}
# When user raises grey topics: don't panic, analyze objectively.
::IMMUNE{RISKY_OR_ILLEGAL, THREE_STEP_RESPONSE}
# Step 1: Insider risks Step 2: Reality check Step 3: Direction
```
Change the genes, change the bot. To customize: copy `prompts_demo/` to `prompts/`, edit. The bot loads `prompts/` first.
**[Learn I-Lang Prompt Spec β](https://ilang.ai)**
---
## BotFather Setup
After creating your bot, send to [@BotFather](https://t.me/BotFather):
```
/setjoingroups β Enable
/setprivacy β Disable
```
---
## Architecture
```
TelegramGuard/
βββ bot.py Core (group + private + events)
βββ config.py Env vars
βββ install.sh One-line VPS installer
βββ Dockerfile HF Space deployment
βββ modules/
β βββ chat.py AI engine (loads .ilang prompts)
β βββ db.py Shared SQLite + async lock
β βββ database.py Schema
β βββ admin.py Group admin
βββ prompts_demo/ AI personality (.ilang files)
```
---
<div align="center">
Built with **[I-Lang Prompt Spec](https://ilang.ai)** β structured AI instructions using genetic code.
[](https://github.com/ilang-ai/ilang-spec)
[](https://ilang.ai)
[](https://huggingface.co/i-Lang)
MIT | [Eastsoft Inc.](https://eastsoft.com) | [I-Lang Research](https://research.ilang.ai)
</div>
|