MRPYWEB

Website, Web Application & Business Systems Development
Back to Portfolios
فوروارد از گروه - سامانه فوروارد خودکار پیام‌های تلگرام

Forward From Group - Automatic Telegram Message Forwarding System

Forward From Group is an intelligent system for automatically forwarding Telegram messages from source groups and channels to destination groups and channels. This project is built using Django 5.2 framework and aiogram…

Overview

About the Project

Forward From Group is an intelligent system for automatically forwarding Telegram messages from source groups and channels to destination groups and channels. This project is built using Django 5.2 framework and aiogram library. The system enables managing multiple source and destination groups, filtering forbidden words, automatically adding admin ID to the beginning of messages, and supporting various content types (text, image, file). The Telegram bot automatically retrieves group chat_ids from Telegram and forwards messages to destination groups with specific time intervals. A dedicated admin panel with secure authentication system provides full control over source and destination groups.

Case Study

Project Case Study

Challenges, solutions, outcomes, technical highlights, architecture, and project scale.

⚡

Challenges

- Need to automatically forward messages from multiple source groups to multiple destination groups
- Automatically retrieving group chat_ids from Telegram without manual intervention
- Managing Telegram message rate limits and preventing bot blockage
- Filtering inappropriate content using forbidden words list
- Automatically adding admin signature to the beginning of each message
- Supporting various content types (text, image, file)
- Dynamically managing enabling/disabling destination groups
- Integrating aiogram bot with Django in one project
- Limiting number of source groups to prevent abuse

💡

Solutions

- Using aiogram for async bot management
- Running bot in separate thread with AppsConfig.ready()
- Implementing resolve_chat_id method for automatic chat_id retrieval from Telegram API
- Filtering forbidden words before forwarding with Forbidden_words model
- Automatic signature addition with replace_or_add_id method
- Supporting various content types by detecting message type (text/photo/document)
- Implementing toggle for enabling/disabling destination groups
- Using socks5 proxy to bypass restrictions
- 10 source groups limit with chanels.count() < 10 condition
- Using sync_to_async for safe Django ORM interaction

📚

Outcomes

- Complete Telegram message auto-forward system
- Support for multiple source and destination groups
- Smart forbidden word filtering
- Automatic admin signature addition
- Support for text, image, and file
- Dynamic management with enable/disable
- Secure admin panel
- Successful integration of aiogram bot with Django
- SOCKS5 proxy support

🔧

Technical Highlights

- Django 5.2.6 and Python 3
- MySQL database with pymysql
- aiogram 3.28 for Telegram bot (async)
- Django REST Framework 3.16 for API
- django-filter for data filtering
- pyotp for two-factor authentication
- persiantools for Jalali date
- Running bot in separate thread
- Automatic chat_id retrieval with Telegram API
- SOCKS5 proxy support (aiohttp_socks)
- sync_to_async for safe ORM interaction
- Forbidden word management
- Automatic signature addition to messages
- Support for text, image, and document

🏗️

Architecture

Forward From Group is built on Django's MVT (Model-View-Template) architecture and consists of two main applications:

1. crm: Responsible for link, user, and admin panel management
- Custom CustomUser model
- Target_chanel_link model for destination groups
- Origin_chanel_link model for source groups
- Forbidden_words model for forbidden words
- My_telegram_id model for admin ID
- group_links, origin_group, forbidden_words, set_my_telegram_id views

2. telegram_bot: Responsible for running Telegram bot
- bot.py file with aiogram Dispatcher
- AppsConfig.ready() to run bot in thread
- forward_handler for group messages
- channel_post_handler for channel messages
- forward_to_targets method for forwarding to destination groups
- BroadcastMessage and TrainingVideo models

The project runs in DEBUG mode and uses SQLite for development and MySQL for production.

📐

Project Scale

- 2 main applications (crm, telegram_bot)
- 7 main data models
- Automatic message forward system
- Dedicated admin panel
- Forbidden word filtering
- Source and destination group link management
- SOCKS5 proxy support
- Custom CustomUser
- Async/threading integration
- 10 source groups limit

Stack

Technologies

Django HTML/CSS JavaScript Python
Categories

Categories

Admin Panel / Dashboard Office Automation
Industry

Industry

Information Technology & Communication
Scope

Scope

Telegram Bot & Automation System Development
Statistics

Project Statistics

8
👁️ Views
0
❤️ Likes
0
⬇️ Downloads
0
⭐ Rating
Metrics

Custom Metrics

Key performance indicators of the project

7 Data Models
2 Applications
Team

Project Team

People who collaborated on this project

حسن کاظمی
Hasan Kazemi
Full Stack Developer

Have a similar project in mind?

If you need collaboration for developing a website, CRM, ERP, or a custom system, I'd be happy to discuss your project.

Start a Project