File tree 3 files changed +44
-0
lines changed
3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Telegram Forward Bot
2
+
3
+ Short description of package/script
4
+
5
+ - Script to forward message from one/multiple chat to another.
6
+ - Telegram Bot API is used to Connect to Telegram. (` https://api.telegram.org ` )
7
+
8
+
9
+
10
+ #### Install Requirements
11
+ ```
12
+ pip3 install telethon
13
+
14
+ ```
15
+
16
+ #### Running Script
17
+ ```
18
+ python3 bot.py
19
+ ```
20
+
21
+ ## Author(s)
22
+
23
+ By Hastech77
Original file line number Diff line number Diff line change
1
+ from telethon import TelegramClient , events
2
+ # from telethon.tl.functions.messages import ForwardMessagesRequest
3
+ api_id = 111111
4
+ # Replace 111111 with Your Telegram API ID
5
+ api_hash = 'Your Telegram Hash ID'
6
+ client = TelegramClient ('anon' , api_id , api_hash )
7
+
8
+
9
+ @client .on (events . NewMessage (outgoing = False ))
10
+ async def handler (event ):
11
+ chat_id = event .chat_id
12
+ # Let's print all the chat ids you are incoming messages from
13
+ print (chat_id )
14
+ if chat_id == 22222 :
15
+ # Replace 22222 with the Chat Id of the origin message Here
16
+ msg = event .raw_text
17
+ await client . send_message (44444 , msg )
18
+ # Replace 44444 with the Chat Id of of the Chat Where To Send
19
+ client .start ()
20
+ client .run_until_disconnected ()
Original file line number Diff line number Diff line change
1
+ telethon
You can’t perform that action at this time.
0 commit comments