Skip to content

proavipatil/affilete-bot

Repository files navigation

Telegram Auto-Forward Bot

A reliable Telegram bot that automatically forwards messages from source channels to destination channels with improved error handling and logging.

Features

  • 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

Setup

1. Get Telegram API Credentials

  • Visit my.telegram.org
  • Create a new application to get APP_ID and API_HASH

2. Generate Session String

3. Configure Environment Variables

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

4. Install Dependencies

pip install -r requirements.txt

5. Run the Bot

Local (Polling):

python bot.py

Webhook (Deployment):

python webhook.py

Configuration

  • FROM_CHANNEL: Source channel IDs separated by spaces
  • TO_CHANNEL: Destination channel IDs separated by spaces
  • ADD_FOOTER: Enable/disable custom footer (True/False)
  • FOOTER_TEXT: Custom text added to forwarded messages
  • BLACKLIST_WORDS: Comma-separated words to filter out
  • WHITELIST_WORDS: Comma-separated words that must be present
  • WEBHOOK_URL: For webhook deployment (optional)
  • PORT: Webhook server port (default: 8080)

Getting Channel IDs

  1. Forward a message from the channel to @userinfobot
  2. The bot will show the channel ID
  3. Use the ID with the minus sign (e.g., -1001234567890)

Deployment

The bot includes configuration for:

  • Heroku (Procfile)
  • Render (render.yml)
  • Local development

Credits

  • Original concept by LmaoDED
  • Enhanced with improved error handling and multi-channel support

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors