-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
406 lines (358 loc) · 18.3 KB
/
bot.py
File metadata and controls
406 lines (358 loc) · 18.3 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
import cloudscraper
import os
from core.helper import get_headers, countdown_timer, extract_user_data, config
from colorama import *
import random
from datetime import datetime
import time
from requests.exceptions import RequestException
class Pumpad:
def __init__(self) -> None:
self.scraper = cloudscraper.create_scraper()
def clear_terminal(self):
os.system('cls' if os.name == 'nt' else 'clear')
def log(self, message):
print(
f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().strftime('%x %X %Z')} ]{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}{message}",
flush=True
)
def set_proxy(self, proxy):
self.scraper.proxies = {
"http": proxy,
"https": proxy,
}
if '@' in proxy:
host_port = proxy.split('@')[-1]
else:
host_port = proxy.split('//')[-1]
return host_port
def welcome(self):
banner = f"""{Fore.GREEN}
██████ ██ ██ ██████ ██ ██ ███ ███ ██████ ███████ ██████
██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ████ ██ ██████ █████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██████ ██████ ██ ██ ██████ ███████ ██ ██
"""
print(Fore.GREEN + Style.BRIGHT + banner + Style.RESET_ALL)
print(Fore.GREEN + f" Pumpad Bot")
print(Fore.RED + f" FREE TO USE = Join us on {Fore.GREEN}t.me/cucumber_scripts")
print(Fore.YELLOW + f" before start please '{Fore.GREEN}git pull{Fore.YELLOW}' to update bot")
print(f"{Fore.WHITE}~" * 60)
def format_seconds(self, seconds):
hours, remainder = divmod(seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return f"{int(hours):02}:{int(minutes):02}:{int(seconds):02}"
def user_information(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/user/information'
self.headers.update({
'Authorization': f'tma {query}'
})
response = self.scraper.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def get_lottery(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/lottery'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def post_lottery(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/lottery'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.post(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def get_checkin(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/raffle/checkin'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def post_checkin(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/raffle/checkin'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.post(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def get_ticket(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/raffle/tickets'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def post_raffle(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/raffle/bets'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.post(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def get_missions(self, query: str):
url = 'https://tg.pumpad.io/referral/api/v1/tg/missions'
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
return None
def post_missions(self, query: str, mission_id: int):
url = f'https://tg.pumpad.io/referral/api/v1/tg/missions/check/{mission_id}'
data = {}
self.headers.update({
'Authorization': f'tma {query}',
})
response = self.scraper.post(url, headers=self.headers, json=data)
if response.status_code == 200:
return response.json()
else:
return None
def process_query(self, query: str):
user = self.user_information(query)
if not user:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Account{Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT} Query ID Isn't Valid {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}or{Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT} Blocked By Cloudflare {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} [ Restart Again ] {Style.RESET_ALL}"
)
return
if user:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Account{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {user['user_name']} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
time.sleep(1)
check_in = self.get_checkin(query)
if check_in and not check_in['is_check_in']:
claim = self.post_checkin(query)
if claim and claim['raffle_count']:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Check-In{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} Day {check_in['consecutive_days'] + 1} {Style.RESET_ALL}"
f"{Fore.GREEN + Style.BRIGHT}Is Claimed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ] [ Reward{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {claim['raffle_count']} Raffle Ticket {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Check-In{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} Day {check_in['consecutive_days'] + 1} {Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT}Isn't Claimed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Check-In{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} Day {check_in['consecutive_days']} {Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT}Is Already Claimed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ]{Style.RESET_ALL}"
)
time.sleep(1)
ticekt = self.get_ticket(query)
if ticekt and ticekt['number_of_tickets'] > 0:
count = ticekt['number_of_tickets']
while count > 0:
raffle = self.post_raffle(query)
if raffle and raffle['number']:
count = raffle['remain_count']
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Raffle{Style.RESET_ALL}"
f"{Fore.GREEN + Style.BRIGHT} Is Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}] [ Number{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {raffle['number']} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}] [ Ticket{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {count} Left {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Raffle{Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT} Isn't Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
break
if count == 0:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Raffle{Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT} No Ticket Remaining {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Raffle{Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT} No Ticket Remaining {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
missions = self.get_missions(query)
if missions['mission_list'] is not None and 'mission_list' in missions:
for mission in missions['mission_list']:
mission_id = mission['mission']['id']
mission_name = mission['mission']['name']
mission_reward = mission['mission']['reward']
done_time = mission['done_time']
if mission_id == 38:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Mission{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {mission_name} {Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT}Skipped{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ]{Style.RESET_ALL}"
)
continue
if done_time == 0:
complete = self.post_missions(query, mission_id)
if complete is True:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Mission{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {mission_name} {Style.RESET_ALL}"
f"{Fore.GREEN + Style.BRIGHT}Is Completed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ] [ Reward{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} +{mission_reward} Draw Count {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Mission{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {mission_name} {Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT}Isn't Completed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Mission{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {mission_name} {Style.RESET_ALL}"
f"{Fore.YELLOW + Style.BRIGHT}Is Already Completed{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} ]{Style.RESET_ALL}"
)
else:
self.log(f"{Fore.GREEN + Style.BRIGHT}[ Mission Clear ]{Style.RESET_ALL}")
time.sleep(1)
draw = self.post_lottery(query)
if draw is not None:
if 'reward' in draw:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Draw{Style.RESET_ALL}"
f"{Fore.GREEN + Style.BRIGHT} Is Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}] [ Reward{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {draw['reward']['name']} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Draw{Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT} Isn't Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
lottery = self.get_lottery(query)
if lottery is not None:
count = lottery['draw_count']
if count != 0:
while count > 0:
draw = self.post_lottery(query)
if draw is not None:
if 'reward' in draw:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Draw{Style.RESET_ALL}"
f"{Fore.GREEN + Style.BRIGHT} Is Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}] [ Reward{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {draw['reward']['name']} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(
f"{Fore.MAGENTA + Style.BRIGHT}[ Draw{Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT} Isn't Success {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}]{Style.RESET_ALL}"
)
else:
self.log(f"{Fore.RED + Style.BRIGHT}[ Data Post Lottery Is None ]{Style.RESET_ALL}")
count -= 1
else:
self.log(f"{Fore.YELLOW + Style.BRIGHT}[ You Don't Have Enough Draw Count ]{Style.RESET_ALL}")
else:
self.log(f"{Fore.RED + Style.BRIGHT}[ Data Get Lottery Is None ]{Style.RESET_ALL}")
def main(self):
try:
with open('query.txt', 'r') as file:
queries = [line.strip() for line in file if line.strip()]
with open('proxies.txt', 'r') as file:
proxies = [line.strip() for line in file if line.strip()]
while True:
self.log(
f"{Fore.GREEN + Style.BRIGHT}Account's Total: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{len(queries)}{Style.RESET_ALL}"
)
self.log(
f"{Fore.GREEN + Style.BRIGHT}Proxy's Total: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{len(proxies)}{Style.RESET_ALL}"
)
self.log(f"{Fore.CYAN + Style.BRIGHT}-----------------------------------------------------------------------{Style.RESET_ALL}")
for i, query in enumerate(queries):
query = query.strip()
if query:
self.log(
f"{Fore.GREEN + Style.BRIGHT}Account: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{i + 1} / {len(queries)}{Style.RESET_ALL}"
)
if len(proxies) >= len(queries):
proxy = self.set_proxy(proxies[i]) # Set proxy for each account
self.log(
f"{Fore.GREEN + Style.BRIGHT}Use proxy: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{proxy}{Style.RESET_ALL}"
)
else:
self.log(
Fore.RED + "Number of proxies is less than the number of accounts. Proxies are not used!")
user_info = extract_user_data(query)
user_id = str(user_info.get('id'))
self.headers = get_headers(user_id)
try:
self.process_query(query)
except Exception as e:
self.log(f"{Fore.RED + Style.BRIGHT}An error process_query: {e}{Style.RESET_ALL}")
self.log(f"{Fore.CYAN + Style.BRIGHT}-{Style.RESET_ALL}" * 75)
account_delay = config['account_delay']
countdown_timer(random.randint(min(account_delay), max(account_delay)))
cycle_delay = config['cycle_delay']
countdown_timer(random.randint(min(cycle_delay), max(cycle_delay)))
except KeyboardInterrupt:
self.log(f"{Fore.RED + Style.BRIGHT}[ EXIT ] Pumpad - BOT{Style.RESET_ALL}")
except Exception as e:
self.log(f"{Fore.RED + Style.BRIGHT}An error occurred: {e}{Style.RESET_ALL}")
if __name__ == "__main__":
pumpad = Pumpad()
pumpad.clear_terminal()
pumpad.welcome()
pumpad.main()