An automated Telegram bot built with Node.js that automatically forwards posts from a source channel to destination channels in real-time.
- ⚡ Instant Forwarding: Automatically forwards new posts as soon as they are published.
- 🎯 Multi-Channel Support: Easily forward messages from one source channel to target channels.
- 📜 Activity Logging: Automatically logs post history and status in
forward.log. - 🛠️ Lightweight & Fast: Minimal setup with very low RAM and CPU consumption.
- Open Telegram and search for @BotFather.
- Send
/newbotand follow the steps to create a new bot. - Copy your Bot Access Token (Keep it secret!).
- Add your bot as an Admin in both source and destination channels with Manage Messages / Post Messages permissions enabled.
- Forward any post from your target channels to @userinfobot to get your Channel IDs (e.g.,
-100123456789).
Clone the repository and install all required dependencies:
git clone https://github.com/BidyutRoy2/tgpost.git
cd tgpost
npm installCreate or edit the .env file to configure your Bot Token and Channel IDs:
nano .env
Add your credentials inside .env: Code snippet
BOT_TOKEN=your_bot_access_token_here
SOURCE_CHANNEL_ID=-100123456789
TARGET_CHANNEL_ID=-100987654321,100987654321,100987654321,Add More
###Step 4: Run the Bot Start the bot locally:
npm start
npm install -g pm2
pm2 start index.js --name "tg-forward-bot"
📄 License : Distributed under the MIT License.