-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathWatcher.py
More file actions
42 lines (35 loc) · 1.19 KB
/
Watcher.py
File metadata and controls
42 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! C:\Users\kosha\AppData\Local\Programs\Python\Python39\python.exe
from telethon.sessions import StringSession
import argparse
from config import *
from scrapers.clients import *
if __name__ == '__main__':
parser = argparse.ArgumentParser()
args = parser.parse_known_args()[1]
if len(args):
ph_no = args[0]
else:
ph_no = input('Enter number: ')
with open('session_ids.csv') as f:
str_sessions_tuple = list()
lines = f.readlines()
for line in lines[1:]:
x = line.split(',')
try:
str_sessions_tuple.append((x[-2].rstrip().replace(' ', ''), x[-1].rstrip()))
except:
continue
ph_dict = dict(str_sessions_tuple)
str_session_id = ph_dict[ph_no.rstrip().replace(' ', '')]
try:
str_session_id = ph_dict[ph_no]
except:
print('Invalid Number')
exit()
cl = TGClient(StringSession(str_session_id), api_id, api_hash)
forwards = list()
for message in cl.get_chat_messages(777000, 1):
if not message.out:
forwards.insert(0, message)
print(message.message)
# cl.forward_messages(RECIPIENT, forwards)