-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
46 lines (33 loc) · 1.39 KB
/
main.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
from utils.core.telegram import Accounts
from utils.starter import start, stats
import asyncio
from data import config
import os
async def main():
print("Soft's author: https://t.me/ApeCryptor\n")
action = int(input("Select action:\n0. About soft\n1. Start soft\n2. Get statistics\n3. Create sessions\n\n> "))
if action == 0:
print(config.SOFT_INFO)
return
if not os.path.exists('sessions'): os.mkdir('sessions')
if config.PROXY['USE_PROXY_FROM_FILE']:
if not os.path.exists(config.PROXY['PROXY_PATH']):
with open(config.PROXY['PROXY_PATH'], 'w') as f:
f.write("")
else:
if not os.path.exists('sessions/accounts.json'):
with open("sessions/accounts.json", 'w') as f:
f.write("[]")
if action == 3:
await Accounts().create_sessions()
if action == 2:
await stats()
if action == 1:
accounts = await Accounts().get_accounts()
tasks = []
for thread, account in enumerate(accounts):
session_name, phone_number, proxy = account.values()
tasks.append(asyncio.create_task(start(session_name=session_name, phone_number=phone_number, thread=thread, proxy=proxy)))
await asyncio.gather(*tasks)
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())