Skip to content

PN-Projects/regex_parser_bot

Repository files navigation

🤖 Regex Parser Bot: The Regex Wizard 🧙‍♂️

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!


🚀 Features That’ll Blow Your Mind

  • 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! 🐳☁️

🛠️ Command Center

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! �

🚀 Quick Start: Let’s Get This Bot Rolling!

Prerequisites

  • 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. 🆔

Installation

  1. Clone the repository (if you haven’t already):
    git clone https://github.com/PN-Projects/regex_parser_bot.git
    cd regex_parser_bot
  2. Install dependencies:
    pip install -r requirements.txt
  3. Set up environment variables: Create a .env file 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
  4. Run the bot:
    python3 bot.py

🐳 Docker Deployment: Because Containers Are Cool

  1. Build the Docker image:
    docker build -t regex-parser-bot .
  2. Run the container:
    docker run --env-file .env regex-parser-bot

☁️ Heroku Deployment: Take It to the Cloud!

  1. Install the Heroku CLI. Because clouds are better with tools. ☁️
  2. Log in to Heroku:
    heroku login
  3. Create a new Heroku app:
    heroku create your-app-name
  4. 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
  5. Deploy the app:
    git push heroku main
  6. Scale the worker:
    heroku ps:scale worker=1

Or Just Click the button below to deploy this bot to Heroku instantly:

Deploy to Heroku

🌟 Contributors: The Real Heroes

Thanks to these jacka** i mean amazing people who have contributed to this project:

satyanandatripathi
satyanandatripathi
AvikaTrivedi
AvikaTrivedi

📄 License: Do What You Want (Within Reason)

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. 😉

💬 Support: We’re Here for You

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! 🧙‍♂️

About

Simple telegram who can parse regular expression to the replied messages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors