File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ ### Telegram_Quotefancy
2
+ - Script to forward message from one/multiple chat to another.
3
+ - Telegram Bot API is used to Connect to Telegram. (` https://api.telegram.org ` )
4
+
5
+
6
+ #### Install Requirements
7
+ ```
8
+ pip3 install telethon
9
+
10
+ ```
11
+
12
+ #### Running Script
13
+ ```
14
+ python3 bot.py
15
+ ```
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
+
4
+
5
+
6
+
7
+
8
+ api_id = < Your Telegram API ID >
9
+ api_hash = 'Your Telegram Hash ID'
10
+ client = TelegramClient ('anon' , api_id , api_hash )
11
+ @client .on (events . NewMessage (outgoing = False ))
12
+ async def handler (event ):
13
+ chat_id = event .chat_id
14
+ # Let's print all the chat ids you are incoming messages from
15
+ print (chat_id )
16
+ #If you just want to get messages from 1 chat just remove the or statement after the 1st one
17
+ if chat_id == < Chat Id of the origin message Here > or chat_id == < Chat Id of the origin message Here > or chat_id == < Chat Id of the origin message Here > :
18
+ msg = event .raw_text
19
+ await client . send_message (< Chat Id of of the Chat Where To Send > ,msg )
20
+
21
+
22
+
23
+ client .start ()
24
+ client .run_until_disconnected ()
You can’t perform that action at this time.
0 commit comments