Skip to content

sa23up/Telegram-Channel-Content-Auto-Forwarding-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文 | English

Telegram Channel Content Auto-Forwarding System - User Manual

📋 Table of Contents


📖 Project Introduction

This is a PHP-based Telegram channel content auto-forwarding system (version v3.7) that uses the MadelineProto library for Telegram API interaction. The system can automatically forward content from source channels to target channels, supporting advanced features such as message filtering, content replacement, and scheduled posting.

Main Purposes

  • Automatically forward Telegram channel content
  • Filter and clean up advertisement messages
  • Batch manage content synchronization across multiple channels
  • Content aggregation and distribution

✨ Features

Core Features

  • ✅ Support for forwarding from multiple source channels to multiple target channels
  • ✅ Real-time auto-forwarding (via CRON tasks)
  • ✅ Support for multiple message types: text, images, videos, files, etc.
  • ✅ Support for album (multi-image) message forwarding
  • ✅ Independent channel filter settings

Content Filtering

  • 🔍 Keyword filtering (spam word filtering)
  • 🔍 Link filtering (optionally delete Telegram links, all links, etc.)
  • 🔍 Inline button filtering
  • 🔍 @username replacement
  • 🔍 Word replacement function

Advanced Features

  • ⏰ Scheduled posting (set posting times by hour)
  • 📊 Posting quantity limits (limit number of posts within time periods)
  • 🗳️ Poll buttons (add like/dislike buttons to images)
  • 📝 Custom message text replacement
  • 🔖 Channel signature (add signature to the bottom of each message)
  • 🎯 Keyword-specific posting (only post content containing specific keywords)
  • 🔄 ForwardMessage mode (preserve original message source)

Content Control

  • Ignore pure text messages
  • Ignore messages with text
  • Ignore messages without media
  • Ignore messages with media
  • Post only pure media content

💻 System Requirements

Server Configuration

  • Operating System: Debian 9 / Ubuntu 14.04 or higher
  • Web Server: Apache2 (supports .htaccess)
  • PHP Version: 7.2 or higher
  • Database: MySQL 5.7+
  • Memory: Minimum 512MB RAM
  • Storage: Minimum 5GB SSD

PHP Extension Requirements

- php7.2-cli
- php7.2-common
- php7.2-curl
- php7.2-json
- php7.2-mbstring
- php7.2-mysql
- php7.2-xml
- php7.2-zip

🚀 Installation and Deployment

Step 1: Prepare VPS Environment

1. Update system and install basic software

apt update
apt install curl nano zip unzip htop sudo -y
apt install ca-certificates apt-transport-https -y

2. Install PHP 7.2

wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
apt update
apt install php7.2 -y
apt install php7.2-cli php7.2-common php7.2-curl php7.2-json php7.2-mbstring php7.2-mysql php7.2-xml php7.2-zip -y

3. Configure Apache

a2enmod rewrite
systemctl restart apache2

4. Install MySQL

apt install mysql-server -y

5. Configure MySQL

mysql -u root

Execute in MySQL console:

UPDATE mysql.user SET authentication_string=PASSWORD('your_password'), plugin='mysql_native_password' WHERE User='root';
CREATE DATABASE AutoPoster;
FLUSH PRIVILEGES;
QUIT;

6. Import database structure

cd /var/www/html
mysql -u root -p AutoPoster < dump.sql

7. Configure Apache permissions

Edit /etc/apache2/apache2.conf file, find:

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Modify to:

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Then restart Apache:

systemctl restart apache2

Step 2: Deploy Panel Files

1. Upload files

Upload the parser_channel folder to the server's /var/www/html/ directory

2. Configure database connection

Edit parser_channel/db.php file:

DEFINE('login','root');           // Database username
DEFINE('pass','your_password');   // Database password
DEFINE('host','localhost');       // Database host
DEFINE('base','AutoPoster');      // Database name

3. Set file permissions

chmod -R 777 /var/www/html/parser_channel/
chmod -R 777 /var/www/html/parser_channel/accounts/

Step 3: Add Telegram Account

1. Enter SSH terminal

cd /var/www/html/parser_channel/

2. Run authentication script

php auth.php

3. Follow prompts

  1. Enter your Telegram phone number (format: +79XXXXXXXXX)
  2. Enter the verification code received in Telegram Desktop
  3. If two-step verification is enabled, enter the password
  4. After successful authentication, a configuration file will be generated (e.g., +79XXXXXXXXX.tg)

4. Set permissions (Important)

chmod 777 /var/www/html/parser_channel/+79XXXXXXXXX.tg
chmod 777 /var/www/html/parser_channel/+79XXXXXXXXX.tg.lock

Or use:

chmod -R 777 /var/www/html/parser_channel/accounts/
chown -R www-data:www-data /var/www/html/parser_channel/accounts/

Step 4: Configure CRON Scheduled Tasks

Method 1: SSH CRON (Recommended)

crontab -e

Add the following:

*/1 * * * * curl -S "http://your_IP_address/parser_channel/multiple_task.php"

Save: Press Ctrl+O, then press Ctrl+X

Method 2: Add via panel

Add task in system's CRON management:

curl -S "http://your_IP_address/parser_channel/multiple_task.php"

If CRON cannot run, execute:

adduser www-data sudo
sudo visudo

Add at the bottom of the file:

www-data ALL=(ALL:ALL) NOPASSWD: ALL

Then:

chown -R www-data /var/www/html/parser_channel/

🔧 Initial Configuration

1. Login to Management Panel

Access: http://your_server_IP/parser_channel/

Default Login Information:

  • Username: admin
  • Password: z6GZ1J66sAve

2. Change Password

After logging in, go to the "Settings" tab, enter a new password, and click "Change"

3. Configure Bot Token (Optional, for poll function)

  1. Create a bot by chatting with @BotFather in Telegram
  2. Get the Bot Token
  3. Enter the Bot Token in "General Settings"
  4. Click "Save"

4. Add Account to Panel

In version v3.7, the system automatically recognizes authenticated accounts, no need to manually fill in the profile_tg field


📘 User Guide

Add Forwarding Task

1. Go to "Manage Channels" tab

2. Select Source Channel

  • Select from dropdown list of joined channels
  • Or select "Specify Other Channel" and manually enter channel link
  • Supported link formats:
    • https://t.me/channel_username
    • https://t.me/joinchat/XXXXXXXXXXXXX

3. Select Target Channel

  • Select from dropdown list of joined channels
  • Or manually enter channel link

4. Click "Add" button

The system will automatically:

  • Join source and target channels (if not already joined)
  • Create forwarding task
  • Create independent filter settings for this task

Important Notes:

  • Add up to 5 channels at a time to avoid triggering Telegram rate limits
  • If rate limit is triggered, wait 10-15 minutes before continuing
  • Your account must be an administrator of the target channel to post messages

Manage Forwarding Tasks

Start/Stop Task

  • Click "Start" button to begin auto-forwarding
  • Click "Stop" button to pause forwarding

Delete Task

Click the trash can icon to delete the task

Modify Channels

Use dropdown lists to change source or target channels


🔍 Feature Details

1. Filter Settings

Keyword Filtering (Spam Word Filtering)

In the "Filter (Stop Words)" text box, enter one keyword per line. Messages containing these keywords will be ignored.

Example:

Advertisement
Gambling
Promotion
1xbet
casino

Word Replacement

Format: original_word|replacement_word (one per line)

Example:

casino|
advertisement|
@spam_channel|@my_channel

Explanation:

  • casino| - Delete the word "casino"
  • @spam_channel|@my_channel - Replace @spam_channel with @my_channel

Delete Specified Links

Enter one domain per line. Links containing these domains will be deleted.

Example:

bit.ly
clc.to
vk.com

2. Content Filtering Mode

Undefined

No special link filtering

Delete All Links

Delete all URL links and inline links in messages

Delete Telegram Links

Only delete links in format t.me/username, t.me/joinchat/XXX, and @Username

Ignore Messages Containing Telegram Links

Do not forward messages if they contain Telegram links

Ignore Messages Containing Any Links

Do not forward messages if they contain any URL links

Replace All Links

Replace all links in messages with your specified link

3. Additional Filtering

Ignore Types

Option Description
Undefined No special filtering
Ignore posts without text Only forward messages with text (media only)
Ignore all posts with text Only forward pure media messages (no text)
Ignore posts with text (no media) Do not forward pure text messages
Ignore posts with text (only media) Ignore media messages with text
Ignore all posts without text Only forward messages with text

4. Post Features

✅ Do not forward posts with inline button links

When checked, filters out advertisement messages containing inline buttons

✅ Ignore posts without media attachments

When checked, only forwards messages containing media such as images, videos, files, etc.

5. Additional Features

Replace Any Source Channel Text

When checked, you can replace all text from the source channel with your custom text. Supports HTML format:

<b>Bold Text</b>
<i>Italic Text</i>
<a href="https://example.com">Link Text</a>

Replace @username in Messages

Replace all @username in messages with your specified username

Poll Buttons (Images Only)

Add like 👍 and dislike 👍 buttons to forwarded images

Usage Conditions:

  1. Bot Token must be configured
  2. Panel must be accessed via HTTPS (SSL certificate required)
  3. Bot must be added to the target channel

Scheduled Posting

When checked, you can select which hours to post content

Example: Only post between 9 AM and 6 PM, check: 09:00 to 18:00

Posting Limit

Limit the number of messages posted within a specified time period

Example:

  • Maximum posts: 10
  • Time period: 2 hours
  • Result: Maximum 10 posts per 2 hours

ForwardMessage

When checked, uses Telegram's native forwarding function, preserving the original message source

Note: This option will be disabled when poll buttons are enabled

6. Channel Signature

Enter text in the "Channel Signature" text box to be added to the bottom of each forwarded message

Example:

🔥 More exciting content, follow @my_channel

7. Keyword Posting

✅ Only post content containing the following keywords

When checked, only messages containing specified keywords will be forwarded

Posting Modes:

  • Consider Filters - Messages still need to pass other filtering rules
  • Bypass Filters - Messages containing keywords are posted directly, ignoring other filtering rules

Keyword Input: (one per line)

Important Notice
Official Announcement
Limited Time Offer

📊 Channel Management

Rename Channel

  1. Go to "General Settings" tab
  2. Select channel from "Rename Channel" dropdown
  3. Enter new name
  4. Click "Change"

Note: This will modify both the channel name in Telegram and the display name in the panel

Switch Account

If multiple Telegram accounts are added:

  1. Select account from "Current Account" dropdown
  2. Click "Switch"

Delete Account

  1. Select account to delete
  2. Click "Delete" button
  3. System will delete account configuration file and related tasks

❓ FAQ

Q1: CRON task not executing, what to do?

A: Try the following steps:

adduser www-data sudo
sudo visudo
# Add: www-data ALL=(ALL:ALL) NOPASSWD: ALL
chown -R www-data /var/www/html/parser_channel/

Q2: "FLOOD_WAIT" error when adding channels

A: This is Telegram's rate limit protection. Wait for the prompted time before trying again (usually 10-15 minutes)

Q3: Messages not forwarding automatically

A: Check the following:

  1. Is CRON task running normally?
  2. Is task status "Started"?
  3. Check if filter settings are too strict
  4. Is account status "Enabled"?

Q4: How to view system logs?

A: Log file location:

/var/log/MadelineProto.log

Q5: Poll button function not working

A: Ensure:

  1. Correct Bot Token is configured
  2. Panel is accessed via HTTPS
  3. Bot is added to target channel
  4. Bot has permission to send messages

Q6: Account banned by Telegram, what to do?

A: Recommendations:

  1. Don't add channels too frequently (max 5 at a time)
  2. Set reasonable posting limits
  3. Avoid posting violating content
  4. Use multiple accounts to distribute risk

Q7: How to backup configuration?

A: Backup the following:

  1. Database: mysqldump -u root -p AutoPoster > backup.sql
  2. Account files: /var/www/html/parser_channel/accounts/
  3. Configuration file: /var/www/html/parser_channel/db.php

⚠️ Important Notes

Security Recommendations

  1. Change Default Password - Change immediately after first login
  2. Restrict Access - Recommend using firewall to limit panel access
  3. Regular Backups - Regularly backup database and configuration files
  4. Use HTTPS - If using poll function, must configure SSL certificate

Usage Limitations

  1. Channel Join Limit - Join max 5 channels at a time to avoid triggering Telegram rate limits
  2. Posting Frequency - Set reasonable posting limits to avoid being identified as spam
  3. Account Permissions - Ensure account has administrator permissions in target channel
  4. Content Compliance - Do not use for posting content violating Telegram Terms of Service

Performance Optimization

  1. Regular Database Cleanup - Delete unnecessary poll records
  2. Monitor Resource Usage - Use htop to monitor server resources
  3. Optimize CRON Frequency - Adjust CRON execution frequency based on actual needs

Troubleshooting Steps

  1. Check Apache error log: tail -f /var/log/apache2/error.log
  2. Check PHP error log: tail -f /var/log/php7.2-fpm.log
  3. Check MadelineProto log: tail -f /var/log/MadelineProto.log
  4. Test database connection: mysql -u root -p AutoPoster
  5. Check file permissions: ls -la /var/www/html/parser_channel/

📞 Technical Support

File Location Reference

  • Main Program Directory: /var/www/html/parser_channel/
  • Account Files: /var/www/html/parser_channel/accounts/
  • Database Configuration: /var/www/html/parser_channel/db.php
  • Apache Configuration: /etc/apache2/apache2.conf
  • Log Files: /var/log/MadelineProto.log

Important Command Reference

# Restart Apache
systemctl restart apache2

# View CRON tasks
crontab -l

# Edit CRON tasks
crontab -e

# View running processes
ps aux | grep php

# Set file permissions
chmod -R 777 /var/www/html/parser_channel/
chown -R www-data:www-data /var/www/html/parser_channel/

📝 Update Log

v3.7 Features

  • Automatic recognition of authenticated accounts
  • Improved multi-account support
  • Optimized channel management interface
  • Enhanced error handling

📄 License Statement

This system is for learning and research purposes only. When using this system, please comply with:

  1. Telegram Terms of Service
  2. Laws and regulations of your region
  3. Content copyright and privacy protection regulations

Disclaimer: Any consequences arising from the use of this system are the sole responsibility of the user.


Last Updated: December 29, 2025 Document Version: 1.0

System Version: v3.7

About

The system can automatically forward content from the source channel to the target channel, supporting advanced features such as message filtering, content replacement, and scheduled posting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors