Bio Analyser is a production-ready Telegram bot that automatically monitors user bios in group chats for links. If a link is found in a user's bio, the bot can warn the user, mute them, or ban them based on configurable settings. This bot helps maintain a clean and safe environment in your Telegram group chats.
⭐ If you find this useful, please star the repo! ⭐
- ✅ Automatically checks user bios for links when they send messages in groups
- ✅ Configurable warnings, mutes, and bans for users with links in their bios
- ✅ Whitelist & Unwhitelist trusted members
- ✅ Cancel Warning - reset a user's warnings instantly
- ✅ Admin-only controls with interactive inline keyboards
- ✅ Production-ready with secure credential management
- ✅ Error handling for robust operation
Try it live: @BioAnalyserBot
Before you begin, ensure you have met the following requirements:
- Python 3.8 or higher
- MongoDB Atlas account (free tier available at mongodb.com/cloud/atlas)
- Telegram Bot Token from @BotFather
- Telegram API credentials from my.telegram.org
git clone https://github.com/SkyBotsDeveloper/BioAnalyser
cd BioAnalyser# Linux/Mac
python3 -m venv venv
source venv/bin/activate
# Windows
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the project root directory:
# Linux/Mac
nano .env
# Windows
notepad .envAdd the following content (with your actual values):
API_ID=your_api_id_here
API_HASH=your_api_hash_here
BOT_TOKEN=your_bot_token_here
MONGO_URI=your_mongodb_connection_string_here
OWNER_ID=your_telegram_user_id
How to get these values:
- API_ID & API_HASH: Visit my.telegram.org → API Development Tools
- BOT_TOKEN: Chat with @BotFather on Telegram →
/start→ Create Bot - MONGO_URI: Create account at MongoDB Atlas → Create Cluster → Copy connection string
- OWNER_ID: Your numeric Telegram user ID. For multiple owners, use
OWNER_IDS=111,222,333
- ❌ NEVER commit
.envto GitHub - ❌ NEVER share your credentials
- ✅ Use
.envfile for local development only - ✅ For server deployments, set environment variables directly
python bio.pyIf successful, you should see:
Bot is running... ✅
After cloning on Ubuntu/Debian VPS:
python3 -m venv venv
source venv/bin/activate
pip install -U pip && pip install -r requirements.txt
sudo apt update && sudo apt install tmux -y
tmux
bash startbash start installs a systemd service named bioanalyser-bot, starts the bot now, restarts it if it crashes, and starts it again automatically after VPS reboot.
Useful commands:
sudo journalctl -u bioanalyser-bot -f
sudo systemctl status bioanalyser-bot
sudo systemctl restart bioanalyser-bot
sudo systemctl stop bioanalyser-botYou can still use tmux if you want a terminal session, but systemd is what keeps the bot permanent after reboot.
- Open your Telegram group
- Click on group name → "Add members"
- Search for @BioAnalyserBot
- Add the bot to your group
- Right-click on the bot in the group
- Click "Promote to admin"
- Enable permissions: ✅ Delete messages, ✅ Restrict members
For Group Admins Only:
/config- Configure warning limit (5, 10, or 15) and punishment (Mute or Ban)/free [reply|id|@username]- Whitelist a user/unfree [reply|id|@username]- Remove user from whitelist/freelist- View all whitelisted users/help- Show help message
Owner Only:
/broadcast your message- Send a text broadcast to every known active DM/group/channel- Reply to any message with
/broadcast- Copy that message to every known active DM/group/channel /stats- Show active groups/channels, known private users, and users who started the bot
The bot records chats after it receives updates from them. If a group/channel/DM has never interacted with this bot version, it will not be in the broadcast list yet.
When Telegram sends a bot removal update, the removed chat is deleted from MongoDB so /stats stays current.
Owner commands are only shown in /help when the user is listed in OWNER_ID or OWNER_IDS.
When a non-whitelisted user posts in the group:
- 🔍 Bot checks their bio for links
⚠️ If link found → Warning issued (count increases)- 🔇 If warnings reach limit → User is muted or banned (based on config)
- ✅ User can be whitelisted to skip checks
Detected Link Types:
- @mentions and @usernames
- Telegram links (t.me/, telegram.me/, tg.me/*)
- HTTP/HTTPS URLs
- Social media profiles (Instagram, TikTok, Twitter, Facebook, YouTube, LinkedIn)
- URL shorteners (bit.ly, ow.ly, tinyurl.com, goo.gl, etc.)
- Domain names (.com, .org, .net, .io, .shop, etc.)
/config → Ban → 5 warnings
/config → Mute → 5 warnings
/free @admin_user
/free @support_bot
/free @official_channel_account
/freelist
BioAnalyser/
├── bio.py # Main bot file
├── config.py # Configuration with environment variables
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .gitignore # Git ignore file
├── helper/
│ └── utils.py # Helper functions
└── README.md # This file
- ✅ Secure Credentials: Uses environment variables (
.envfile) - ✅ Error Handling: Graceful handling of invalid user IDs
- ✅ Admin Verification: Only admins can configure the bot
- ✅ Permission Checks: Validates bot admin rights before actions
- ✅ Production Ready: Tested and optimized for stability
Solution:
pip install python-dotenvSolution:
- Ensure
.envfile exists in project root - Check that all required variables are present (API_ID, API_HASH, BOT_TOKEN, MONGO_URI)
- Verify there are no typos in variable names
Solution:
# Check your .env file
cat .env
# Or verify credentials are correct
# Test MongoDB connection
python -c "from motor.motor_asyncio import AsyncIOMotorClient; print('MongoDB OK')"Solution:
- Make sure bot has admin rights in the group
- Check permissions: Delete messages ✅, Restrict members ✅
Solution:
- Make sure the bot has access to user profiles
- Check that the user being checked is not an admin
- Verify the user's bio contains an actual link
Your requirements.txt should contain:
pyrogram==1.4.16
py-tgcalls==0.9.7
yt-dlp==2023.11.16
httpx==0.25.0
motor==3.3.1
pillow==10.0.1
python-dotenv==1.0.0
Install with:
pip install -r requirements.txtpython bio.py# Using nohup (runs in background)
nohup python bio.py > bot.log 2>&1 &
# Using screen
screen -S biobot
python bio.py
# Press Ctrl+A then D to detachCreate Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "bio.py"]Build and run:
docker build -t bioanalyser .
docker run -d --env-file .env bioanalyserThis project is provided as-is for educational and personal use.
- Name: Siddhartha Abhimanyu
- Telegram: @IflexElite
- Channel: @VivaanUpdates
- Support: @VivaanSupport
Feel free to reach out if you have any questions, feedback, or suggestions!
If you find this bot helpful:
- ⭐ Star this repository
- 📢 Share with others (with credit)
- 🐛 Report bugs via GitHub Issues
- 💡 Suggest features via GitHub Issues
- 👥 Contribute via Pull Requests
- ✅ Fixed critical bug: undefined variable
user_name - ✅ Added error handling for invalid user IDs
- ✅ Implemented secure credential management with
.envfile - ✅ Simplified and improved warning logic
- ✅ Added comprehensive error messages
- ✅ Production-ready code with full documentation
- ✅ Added
.gitignoreto prevent credential exposure
- Setup Guide: See
setup_guide.md - Bug Fixes: See
bioanalyser_bug_fixes.md - Security: See
config_security_report.md
Made with ❤️ by Siddhartha
⭐ Don't forget to star the repository! ⭐