-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathpublic.py
56 lines (38 loc) · 1.53 KB
/
public.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from telethon.sync import TelegramClient
from telethon import utils
import csv
from telethon.tl.functions.channels import JoinChannelRequest
with open('phone.csv', 'r') as f:
str_list = [row[0] for row in csv.reader(f)]
print(str_list)
po = 0
for pphone in str_list:
print(pphone)
phone = utils.parse_phone(pphone)
po += 1
with open('api.csv', 'r') as api_obj_id:
# pass the file object to reader() to get the reader object
csv_reader = csv.reader(api_obj_id)
# Pass reader object to list() to get a list of lists
list_of_rows = list(csv_reader)
row_number = int(po)
col_number = 1
deltaop = list_of_rows[row_number - 1][col_number - 1]
with open('api.csv', 'r') as hash_obj:
csv_reader = csv.reader(hash_obj)
# Pass reader object to list() to get a list of lists
list_of_rows = list(csv_reader)
row_number = int(po)
col_number = 2
deltaxd = list_of_rows[row_number - 1][col_number - 1]
api_id = int(deltaop)
api_hash = str(deltaxd)
print(f"Joining Via {phone}")
client = TelegramClient(f"sessions/{phone}", api_id, api_hash)
client.start(phone)
channel = client.get_entity('https://t.me/whitehattelegrammemberadder')
client(JoinChannelRequest(channel))
client.disconnect()
print()
done = True
input("Done!" if done else "Error!")