File size: 2,601 Bytes
a230509
957d007
 
 
 
 
 
a230509
 
 
 
 
 
 
 
cc6f785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: TelegramGuard
emoji: 🛡️
colorFrom: blue
colorTo: cyan
sdk: docker
pinned: false
license: mit
tags:
  - telegram
  - anti-spam
  - ilang
  - chatbot
---

# I-Lang Guard

AI-powered Telegram group guardian. Anti-spam, vision, chat — all driven by [I-Lang Prompt Spec](https://github.com/ilang-ai/ilang-spec).

## What It Does

- **Anti-spam**: AI detects ads, scams, political content, porn, and repeat flooding. Deletes messages and bans spammers automatically.
- **Vision**: Understands images and video thumbnails. Catches image-based spam too.
- **Chat**: @ the bot in any group for AI conversation.
- **Zero config**: Add to group → grant admin permissions → done.

## Deploy Your Own (3 Steps)

### Option A: HuggingFace Space (Free, Zero Server)

1. Fork this repo
2. Create a [HuggingFace Space](https://huggingface.co/new-space) (Docker SDK)
3. Add secrets in Space Settings:

| Secret | How to get it |
|--------|--------------|
| `BOT_TOKEN` | Talk to [@BotFather](https://t.me/BotFather) on Telegram |
| `GEMINI_API_KEY` | Free at [aistudio.google.com](https://aistudio.google.com) |

### Option B: VPS

```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 Your Bot

All prompts live in `prompts_demo/` as `.ilang` files:

| File | Controls |
|------|----------|
| `persona.ilang` | Bot personality, tone, rules |
| `antispam.ilang` | What counts as spam |
| `vision.ilang` | How to read images |

To customize: copy `prompts_demo/` to `prompts/`, edit the `.ilang` files. The bot loads `prompts/` first, falls back to `prompts_demo/`.

Prompts use [I-Lang Prompt Spec](https://github.com/ilang-ai/ilang-spec) — a structured format for AI instructions using GENE framework, IMMUNE rules, and layered architecture. Learn more at [ilang.ai](https://ilang.ai).

## Architecture

```
bot.py              Main handler
modules/
  chat.py           AI calls (loads .ilang prompts)
  db.py             Single shared SQLite connection
  database.py       Schema
  admin.py          Group admin helpers
prompts_demo/       Open-source demo prompts (.ilang)
prompts/            Your custom prompts (.gitignore'd)
```

## BotFather Setup

After creating your bot, send these to [@BotFather](https://t.me/BotFather):

```
/setjoingroups → Enable
/setprivacy → Disable (so bot can see all group messages)
```

## License

MIT

---

Powered by [I-Lang Prompt Spec](https://ilang.ai) | [Eastsoft Inc.](https://eastsoft.com)