Skip to content

b1ank1108/tg-fwd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📨 Telegram Channel Forwarder

中文说明

Cursor

Developed with Cursor

🎯 Introduction

Telegram Channel Forwarder is a tool designed to forward messages between Telegram channels/groups when the native forwarding feature is disabled. This is particularly useful when:

  • The source channel has disabled message forwarding
  • You need to forward messages to multiple channels simultaneously
  • You want to filter certain messages using blacklist

✨ Features

  • Forward messages from multiple source channels to multiple target channels
  • Support text, images, videos, documents, and other media types
  • Message filtering with blacklist (keywords and full text matching)
  • Export channel list for easy configuration
  • Offline mode operation while forwarding

🚀 Installation

  1. Clone the repository:
git clone https://github.com/yourusername/tg-fwd.git
cd tg-fwd
  1. Install dependencies:
pip install -r requirements.txt
  1. Get your Telegram API credentials:

⚙️ Configuration

  1. Export your channel list:
python main.py --export-channels channels.json

This will create a channels.json file with detailed channel information.

  1. Edit the configuration file:
telegram:
  api_id: 123456               # Your API ID
  api_hash: "abcdef1234567890" # Your API Hash
  session_name: "tg_fwd"       # Session file name

blacklist:
  text:                        # Messages containing these texts will be filtered
    - "Forwarding disabled"
    - "AD"
  keywords:                    # Messages matching these keywords will be filtered
    - "test"
    - "spam"

channels:
  listened_groups_id:          # Source channel IDs
    - -1001234567890
    - -1009876543210
  fwd_channels:               # Target channel IDs (in corresponding order)
    - -1002345678901
    - -1002109876543

🔧 Usage

  1. Run the forwarder:
python main.py -c config.yaml
  1. Export channel list:
python main.py --export-channels channels.json

⚠️ Notes

  • The bot needs to be a member of both source and target channels
  • For channels, you need to be an administrator
  • Messages are forwarded as they are received (real-time)
  • Media files are temporarily downloaded before forwarding
  • The bot operates in offline mode while forwarding messages

📋 Prerequisites

  • Python 3.7 or higher
  • Valid Telegram API credentials (api_id and api_hash)

🔍 Troubleshooting

Check the tg_fwd.log file for detailed running information and error logs.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Telegram 频道转发工具,支持禁止转发消息的频道

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages