-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
77 lines (63 loc) · 2.55 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import sys,os,time
from core.headers import headers
from core.token import get_token
from core.info import get_info, get_info_energy, get_user_dao, get_username, banner
from core.task import Task
from threading import Thread
from datetime import datetime
class Game:
def __init__(self):
self.data_file = self.file_path(file_name="data.txt")
def file_path(self, file_name: str):
# Get the directory of the file that called this method
caller_dir = os.path.dirname(
os.path.abspath(sys._getframe(1).f_code.co_filename)
)
# Join the caller directory with the file name to form the full file path
file_path = os.path.join(caller_dir, file_name)
return file_path
def clear_terminal(self):
"""Clears the terminal screen."""
if os.name == 'nt':
os.system('cls') # For Windows
else:
os.system('clear') # For Linux/Unix
def check_and_mine(self,token,info):
task = Task([token])
mining_result = task.start_mining()
if not mining_result:
print(f"Mining stopped for: {info} due to low energy.")
return False
return True
def main(self):
while True:
now = datetime.now()
dt_string = now.strftime("%d-%m-%Y %H:%M:%S")
data = open(self.data_file, "r").read().splitlines()
tokens = []
for data_entry in data:
token = get_token(data=data_entry)
if token:
tokens.append(token)
info = get_info(token=token)
username = get_username(token=token)
print("===============================")
print(f"{dt_string}")
print(f"Info: {info}")
if self.check_and_mine(token, info):
print("Mining successful.")
else:
print(f"Mining stopped due to low energy, moving to next user.")
print(f"Info: {info}")
print("===============================")
print(f"{dt_string}")
print("All users have low energy, pausing for 1 hour...")
time.sleep(3600)
self.clear_terminal()
if __name__ == "__main__":
banner()
try:
game = Game()
game.main()
except KeyboardInterrupt:
sys.exit()