A Python tool for managing Telegram group members using the Telethon API.
For educational purposes only.
If you find this project useful for learning about Telegram APIs, please give it a star to show your support.
THIS TOOL IS FOR EDUCATIONAL PURPOSES ONLY.
- Do NOT use this for spamming or harassment
- Only use with groups you administrate
- Only add users who explicitly consent
- Respect Telegram's Terms of Service
- Violating Telegram ToS can result in account bans
- This code is for learning purposes only
- Python 3.7 or higher
- Active Telegram account
- Telegram API credentials (https://my.telegram.org)
- Admin rights in target groups (for adding members)
git clone https://github.com/YafetGetu/tg-member-scraper.git
cd tg-member-scraperpip install -r requirements.txt- Visit https://my.telegram.org
- Login with your Telegram account
- Go to API Development Tools
- Create a new application
- Copy your
api_idandapi_hash
Create a .env file and add your credentials:
TELEGRAM_API_ID=your_api_id_here
TELEGRAM_API_HASH=your_api_hash_heretg-member-scraper/
├── csv/ # CSV files storage
├── mem_scrap.py # Member scraping tool
├── add_mem.py # Member adding tool
├── requirements.txt # Python dependencies
├── .env_example # Environment template
├── .gitignore # Git ignore file
└── README.md # Documentation
Scrapes member data from a Telegram group and saves it to CSV.
Features:
- Collects usernames and user IDs
- Saves output to CSV
- Uses Telethon async API
Usage:
python mem_scrap.pyAdds members to a Telegram group from a CSV file.
Features:
- Reads users from CSV
- Includes delay to reduce flood risk
- Handles common Telethon errors
- Prints progress and errors
Usage:
python add_mem.pyBoth tools use CSV files in this format:
username,id
username1,123456789
username2,987654321CSV files are automatically saved to and loaded from the csv/ directory.
Before using this tool:
- Never commit
.envor session files - Use a secondary Telegram account if possible
- Do not reduce delay values
- Keep API credentials private
- Follow Telegram Terms of Service
Recommended .gitignore entries:
.env
*.session
- Use this tool for learning API integration
- Test on private or owned groups
- Ask permission before adding users
- Respect user privacy
- Spam users
- Add members without consent
- Bypass Telegram restrictions
- Use for commercial or malicious purposes
- Wait the specified number of seconds
- Do not lower delay times
- Ensure you are a member
- Verify group exists
- Confirm admin permissions
- Verify API credentials
- Check internet connection
- Ensure Telegram account is active
- Run the tool once to create session files
- Make sure you have write permissions
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
This project is licensed under the MIT License.
This tool is intended for educational purposes only. The author assumes no responsibility for misuse or violations of Telegram’s Terms of Service.
If this project helped you learn something new, consider starring the repository.