---
title: TelegramGuard
emoji: π‘οΈ
colorFrom: blue
colorTo: indigo
sdk: static
pinned: false
license: mit
tags:
- telegram
- anti-spam
- ilang
- chatbot
---
# π‘οΈ 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)**
---
## 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)
```
---
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)