-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.py
36 lines (32 loc) · 1.04 KB
/
code.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
import api
import config
import time
import os
import glob
import re
from telethon import TelegramClient
import asyncio
loop = asyncio.get_event_loop()
client = TelegramClient('ADMIN2' , config.API_ID, config.API_HASH)
client.start()
while(True):
files = glob.glob('Data/ZZZ*')
for f in files:
file = open(f,'r')
lines = file.readlines()
file.close()
id = f[8:-4]
user_id = lines[0].strip('\n')
message_id = lines[1].strip('\n')
pri = lines[2].strip('\n')
status = api.check_status(id)
if(status['DESCRIPTION']=="code received"):
code = status['CODE']
loop.run_until_complete(client.send_message("@"+config.Bot_Username,"/Code ("+user_id+")("+message_id+")("+code+")"))
os.remove(f)
elif(status['DESCRIPTION']=="wait code"):
continue
else:
loop.run_until_complete(client.send_message("@"+config.Bot_Username,"/Cancel ("+user_id+")("+message_id+")("+pri+")"))
os.remove(f)
time.sleep(1)