Giter VIP home page Giter VIP logo

telegram-message-forwarder-bot's Introduction

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

  • api_id - Your Telegram API ID.
  • api_hash - Your Telegram API Hash.
  • session_string - (Optional if bot_token is provided) Session string of your Telegram account. You can get it by running get_session.py file.
  • bot_token - (Optional if session_string is provided) Bot token of your Telegram bot. You can get it by creating a bot using BotFather.
  • sudo_users - (Optional) List of user ids of users who can use the bot. You can get your user id by sending /id command to Rose.
[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

  • from - Chat id of the chat from which messages will be forwarded. You can get it by sending /id command to Rose.
  • to - Chat id of the chat to which messages will be forwarded. You can get it by sending /id command to Rose.
  • replace - (Optional) A dictionary of strings to replace in the message. The key is the string to be replaced and the value is the string to replace with. This is optional.

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

  • Supported identifier for a chat should be the chat id.
  • Use /forward command to forward older messages. For message older than 2 days you have to login as a user and set the session_string variable in pyrogram section. Command usage - /forward <Chat ID/Username/Message Link> <Limit, No. of Messages to forward> <ID of the last message of from chat to avoid repetition>

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

  • Fork the repository.
  • Create a new branch.
  • Make your changes.
  • Commit and push the changes to your fork.
  • Create a pull request.

Support

Copyright & License

telegram-message-forwarder-bot's People

Contributors

viperadnan-git avatar tompluess avatar irajdeeppalsana avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.