|
|
||
|---|---|---|
| routers | ||
| services | ||
| .gitignore | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| config.py | ||
| main.py | ||
| requirements.txt | ||
README.md
Telegram Gatekeeper Bot
A Telegram bot that verifies new users when they join a group and automatically removes unverified users after a timeout.
✨ Features
- 🛡️ Restricts new users on join (supergroups)
- 😀 Emoji-based human verification
- ⏱️ Auto-kicks users who fail to verify in time
- 👮 Admins are automatically bypassed
- 🧹 Cleans up join / leave / kick service messages
- 🔄 Automatically detects group type (supergroup vs normal group)
ℹ️ Group Type Behavior
Telegram has different capabilities for normal groups and supergroups. This bot automatically detects the group type and adjusts its behavior.
- ✅ Supergroup → Full gatekeeper protection (verification, timeout, cleanup)
- ⚠️ Normal group → Limited mode (no user restrictions)
To enable full protection, convert your group into a supergroup:
- Make the group public (set a username), or
- Let Telegram auto-upgrade it automatically
🚀 Deploy on Railway
Click the button below to deploy instantly:
Required Environment Variables
| Variable | Description |
|---|---|
| BOT_TOKEN | Telegram bot token from @BotFather |
| VERIFY_TIMEOUT | Seconds before kicking unverified users (default: 60) |
🤖 Bot Setup
- Create a bot using @BotFather
- Copy the bot token
- Deploy this project on Railway
- Set the BOT_TOKEN environment variable
- Add the bot to your Telegram group as admin
- Grant permissions:
- Restrict users
- Ban users
- Delete messages
🧪 How It Works
- User joins the group
- Bot restricts the user
- Emoji verification message is sent
- User clicks the correct emoji
- Restrictions are removed
- If the user does nothing → bot kicks them after the timeout
🛠️ Local Development (Optional)
pip install -r requirements.txt
export BOT_TOKEN=your_token_here
python main.py
📜 License
MIT License