-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
167 lines (148 loc) · 6.2 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import json
import random
from urllib.parse import parse_qs, unquote
from colorama import Fore, Style, init
import time
from tomarket import Tomarket, print_timestamp
import sys
def load_credentials():
try:
with open('query_id.txt', 'r') as f:
queries = [line.strip() for line in f.readlines()]
return queries
except FileNotFoundError:
print("File query_id.txt tidak ditemukan.")
return [ ]
except Exception as e:
print("Terjadi kesalahan saat memuat token:", str(e))
return [ ]
def parse_query(query: str):
parsed_query = parse_qs(query)
parsed_query = {k: v[0] for k, v in parsed_query.items()}
user_data = json.loads(unquote(parsed_query['user']))
parsed_query['user'] = user_data
return parsed_query
def get(id):
tokens = json.loads(open("tokens.json").read())
if str(id) not in tokens.keys():
return None
return tokens[str(id)]
def save(id, token):
tokens = json.loads(open("tokens.json").read())
tokens[str(id)] = token
open("tokens.json", "w").write(json.dumps(tokens, indent=4))
def generate_token():
tom = Tomarket()
queries = load_credentials()
sum = len(queries)
for index, query in enumerate(queries):
parse = parse_query(query)
user = parse.get('user')
print_timestamp(f"{Fore.CYAN + Style.BRIGHT}[ Account {index+1}/{sum} {user.get('username','')} ]{Style.RESET_ALL}")
token = get(user['id'])
if token == None:
print_timestamp("Generate token...")
time.sleep(2)
token = tom.user_login(query)
save(user.get('id'), token)
print_timestamp("Generate Token Done!")
def main():
init(autoreset=True)
tom = Tomarket()
auto_task = input("auto clear task y/n : ").strip().lower()
auto_game = input("auto play game y/n : ").strip().lower()
auto_combo = input("auto claim combo puzzle y/n : ").strip().lower()
random_number = input("set random score in game 300-500 y/n : ").strip().lower()
free_raffle = input("enable free raffle y/n : ").strip().lower()
# selector_game = input("playing random score game (400-600) y/n ? ").strip().lower()
used_stars = input("use star for : 1. upgrade rank | 2.auto spin | n.(skip all) (1/2/n): ").strip().lower()
while True:
queries = load_credentials()
sum = len(queries)
delay = int(3 * random.randint(3700, 3750))
# generate_token()
start_time = time.time()
for index, query in enumerate(queries):
mid_time = time.time()
total = delay - (mid_time-start_time)
parse = parse_query(query)
user = parse.get('user')
token = get(user['id'])
if token == None:
token = tom.user_login(query)
save(user.get('id'), token)
time.sleep(2)
print_timestamp(f"{Fore.CYAN + Style.BRIGHT}[ Account {index+1}/{sum} {user.get('username','')} ]{Style.RESET_ALL}")
tom.rank_data(token=token, selector=used_stars)
time.sleep(2)
tom.claim_daily(token=token)
time.sleep(2)
tom.start_farm(token=token)
time.sleep(2)
if free_raffle == "y":
tom.free_spin(token=token, query=query)
time.sleep(2)
if auto_task == 'y':
for index, query in enumerate(queries):
mid_time = time.time()
total = delay - (mid_time-start_time)
if total <= 0:
break
parse = parse_query(query)
user = parse.get('user')
token = get(user['id'])
if token == None:
token = tom.user_login(query)
print_timestamp(f"{Fore.CYAN + Style.BRIGHT}[ Account {index+1}/{sum} {user.get('username','')} ]{Style.RESET_ALL}")
tom.list_tasks(token=token,query=query)
if auto_combo == 'y':
tom.puzzle_task(token, query)
# tom.rank_data(token=token)
time.sleep(2)
if auto_game == 'y':
for index, query in enumerate(queries):
mid_time = time.time()
total = delay - (mid_time-start_time)
if total <= 0:
break
parse = parse_query(query)
user = parse.get('user')
token = get(user['id'])
if token == None:
token = tom.user_login(query)
print_timestamp(f"{Fore.CYAN + Style.BRIGHT}[ Account {index+1}/{sum} {user.get('username','')} ]{Style.RESET_ALL}")
tom.user_balance(token=token, random_number=random_number)
time.sleep(2)
end_time = time.time()
total = delay - (end_time-start_time)
hours, remainder = divmod(total, 3600)
minutes, seconds = divmod(remainder, 60)
print(f"{Fore.YELLOW + Style.BRIGHT}[ Restarting In {int(hours)} Hours {int(minutes)} Minutes {int(seconds)} Seconds ]{Style.RESET_ALL}")
if total > 0:
time.sleep(total)
def start():
print(r"""
╔════════════ ⋆ TOMARKET BOT ⋆ ═════════════╗
║ Bot Automation ║
║ Developed by @iamak_roy ║
║ Join here : https://t.me/scripthub00 ║
╚═══════════════════════════════════════════╝
dark life
select this one :
1. claim daily
2. generate token
""")
selector = input("Select the one : ").strip().lower()
if selector == '1':
main()
elif selector == '2':
generate_token()
else:
exit()
if __name__ == '__main__':
try:
start()
except Exception as e:
print_timestamp(f"{Fore.RED + Style.BRIGHT}[ {e} ]{Style.RESET_ALL}")
except KeyboardInterrupt:
sys.exit(0)