forked from petyasoft/OneWin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (33 loc) · 1.48 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
from utils.core import create_sessions
from utils.telegram import Accounts
from utils.onewin import OneWin
from data.config import hello,USE_PROXY
import asyncio
import os
async def main():
print(hello)
action = int(input('Выберите действие:\n1. Начать сбор монет\n2. Создать сессию\n>'))
if not os.path.exists('sessions'):
os.mkdir('sessions')
if action == 2:
await create_sessions()
if action == 1:
accounts = await Accounts().get_accounts()
tasks = []
if USE_PROXY:
proxy_dict = {}
with open('proxy.txt','r',encoding='utf-8') as file:
proxy = [i.strip().split() for i in file.readlines() if len(i.strip().split()) == 2]
for prox,name in proxy:
proxy_dict[name] = prox
for thread, account in enumerate(accounts):
if account in proxy_dict:
tasks.append(asyncio.create_task(OneWin(account=account, thread=thread, proxy=proxy_dict[account]).main()))
else:
tasks.append(asyncio.create_task(OneWin(account=account, thread=thread,proxy = None).main()))
else:
for thread, account in enumerate(accounts):
tasks.append(asyncio.create_task(OneWin(account=account, thread=thread,proxy = None).main()))
await asyncio.gather(*tasks)
if __name__ == '__main__':
asyncio.run(main())