viperadnan-git / telegram-message-forwarder-bot

A telegram bot to forward messages automatically when they arrived.
GNU General Public License v3.0
338 stars 464 forks source link
telegram telegram-bot telegram-forward-bot telegram-forwarder telegram-message-forwarder telegram-message-sender telegram-sender

Telegram Message Forwarder Bot

A telegram bot, which can forward messages from channel, group or chat to another channel, group or chat automatically.

Deploy

Configuration

To configure this bot you have to use the file template at sample.config.toml. Rename it to config.toml and fill the values as described below. If you want to pass the values as environment variables, then pass the content of the config.toml file as environment variable CONFIG.

Pyrogram Section

[pyrogram]
api_id = 12345                                                      # required
api_hash = "0123456789abcdef0123456789abcdef"                       # required
bot_token = "123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ"                  # either bot_token or session_string is required
session_string = "1BVn1-ABCD1234efgh5678IJKLmnoPQRsTUVwxyZxxxxxxxx" # either bot_token or session_string is required
sudo_users = [123456789, 123456789]                                 # optional

Chats Section

You can add multiple chats by using the following format.

[[chats]]
from = -100123456789        # required
to = 123456789              # required
replace = { "old" = "new" } # optional

[[chats]]
from = [123456789, -100123456789]               # required
to = 123456789                                  # required
replace = { "only_apply_to_this_chat" = "new" } # optional

[[chats]]
from = -100123456789            # required
to = [123456789, -100123456789] # required

Note: The chats should be in the format of int or list of int. If you want to use usernames, then you have to use the chat_id of the chat. You can get it by sending /id command to Rose.

Note

Deployment

Clone the repository

git clone <repo-url> telegram-message-forwarder-bot
cd telegram-message-forwarder-bot

Install the requirements

Install the required Python Modules in your machine.

pip3 install -r requirements.txt

Start the bot

With python3.10 or later.

python3 -m bot

Docker

Build the image.

docker build -t telegram-message-forwarder-bot .

Run the container.

docker run -d --name telegram-message-forwarder-bot telegram-message-forwarder-bot

Contributing

Support

Copyright & License