Welcome to the Regex Parser Bot, your friendly neighborhood Telegram bot that’s here to make regex magic happen! Built with Telethon and powered by PostgreSQL, this bot is your go-to tool for parsing messages, managing users and groups, and broadcasting like a pro. Whether you're a regex ninja or just getting started, this bot has got your back!
- Regex Parsing: Reply to any message with a regex pattern, and watch the bot work its magic! ✨
- User & Group Management: Automatically stores user and group IDs in a sleek PostgreSQL database. No duplicates, no drama! 🎯
- Broadcast Messages: Send messages to all users, groups, or both with a single command. Spread the word like a boss! 📢
- Real-Time Stats: Get instant stats about the number of users and groups in the database. Knowledge is power! 📊
- Modular Design: Clean, maintainable, and scalable codebase. Because messy code is a big no-no! �
- Docker & Heroku Ready: Deploy like a pro with Docker and Heroku support. Your bot, your rules! 🐳☁️
Here’s how you can boss around your bot:
| Command | Description |
|---|---|
/start |
Start the bot and get added to the database. Easy peasy! 🎉 |
/help |
Show a list of available commands. Help is just a command away! 🆘 |
/stats |
Display the number of users and groups in the database. Stats don’t lie! 📈 |
/broadcast -u <msg> |
Broadcast a message to all users. Shout it out! 📣 |
/broadcast -g <msg> |
Broadcast a message to all groups. Group hug! 🤗 |
/broadcast -all <msg> |
Broadcast a message to both users and groups. Go big or go home! 🏠 |
| Reply with regex | Apply a regex pattern to the replied message. Regex wizardry at its best! � |
- Python 3.9+: Because who uses Python 2 anymore? 🐍
- PostgreSQL: The database of champions. 🏆
- Telegram API ID and Hash: Get these from my.telegram.org. 🆔
- Clone the repository (if you haven’t already):
git clone https://github.com/PN-Projects/regex_parser_bot.git cd regex_parser_bot - Install dependencies:
pip install -r requirements.txt - Set up environment variables:
Create a
.envfile and add the following:API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token DATABASE_URI=postgresql://user:password@localhost:5432/telegram_bot - Run the bot:
python3 bot.py
- Build the Docker image:
docker build -t regex-parser-bot . - Run the container:
docker run --env-file .env regex-parser-bot
- Install the Heroku CLI. Because clouds are better with tools. ☁️
- Log in to Heroku:
heroku login - Create a new Heroku app:
heroku create your-app-name - Set environment variables:
heroku config:set API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token DATABASE_URI=your_database_uri - Deploy the app:
git push heroku main - Scale the worker:
heroku ps:scale worker=1
Or Just Click the button below to deploy this bot to Heroku instantly:
Thanks to these jacka** i mean amazing people who have contributed to this project:
satyanandatripathi |
AvikaTrivedi |
This project is licensed under the MIT License. See the LICENSE file for details. Basically, do whatever you want, but don’t blame us if it breaks. 😉
For any questions or issues, please open an issue on GitHub. We’ll get back to you faster than a regex match! ⚡
Made with ❤️ by PN-Projects. Now go forth and parse like a pro! 🧙♂️