A reliable Telegram bot that automatically forwards messages from source channels to destination channels with improved error handling and logging.
- Forward messages from multiple source channels to multiple destination channels
- Preserves message formatting, captions, and reply markup
- Word filtering with blacklist/whitelist support
- Custom footer for forwarded messages
- Webhook support for cloud deployment
- Comprehensive error handling and logging
- Configuration validation
- Visit my.telegram.org
- Create a new application to get
APP_IDandAPI_HASH
- Use this Colab notebook to generate your session string
Edit config.env file:
APP_ID=your_app_id
API_HASH=your_api_hash
SESSION=your_session_string
FROM_CHANNEL=-1001234567890 -1001234567891
TO_CHANNEL=-1001234567892 -1001234567893
ADD_FOOTER=True
FOOTER_TEXT=📢 Forwarded by MyBot
BLACKLIST_WORDS=spam,advertisement,scam
WEBHOOK_URL=https://yourapp.herokuapp.com/webhook
pip install -r requirements.txtLocal (Polling):
python bot.pyWebhook (Deployment):
python webhook.pyFROM_CHANNEL: Source channel IDs separated by spacesTO_CHANNEL: Destination channel IDs separated by spacesADD_FOOTER: Enable/disable custom footer (True/False)FOOTER_TEXT: Custom text added to forwarded messagesBLACKLIST_WORDS: Comma-separated words to filter outWHITELIST_WORDS: Comma-separated words that must be presentWEBHOOK_URL: For webhook deployment (optional)PORT: Webhook server port (default: 8080)
- Forward a message from the channel to @userinfobot
- The bot will show the channel ID
- Use the ID with the minus sign (e.g., -1001234567890)
The bot includes configuration for:
- Heroku (Procfile)
- Render (render.yml)
- Local development
- Original concept by LmaoDED
- Enhanced with improved error handling and multi-channel support