•  


GitHub - viperadnan-git/telegram-message-forwarder-bot: A telegram bot to forward messages automatically when they arrived.
Skip to content

viperadnan-git/telegram-message-forwarder-bot

Repository files navigation

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

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본