jerrrycans commited on
Commit
75b51d1
·
verified ·
1 Parent(s): f4937d1

Update ccc.py

Browse files
Files changed (1) hide show
  1. ccc.py +45 -687
ccc.py CHANGED
@@ -1,693 +1,51 @@
1
- import aiohttp
2
- import discord
3
- from discord.ext import commands
4
- import asyncio
5
- import json
6
- import re
7
- from collections import defaultdict, deque
8
- from datetime import datetime, timedelta
9
- import pytz
10
- import os
11
- import traceback
12
-
13
- TOKEN = os.environ['TOKEN']
14
- CHANNEL_ID = 1298830206387228682
15
- MONITORED_ITEMS_CHANNEL_ID = 1307752080139878500
16
- AUTHORIZED_USER_ID = 1219416244806094883
17
-
18
- PETS_API = 'https://petsapi.deno.dev/'
19
- EXISTS_API = 'https://existsapi.deno.dev/'
20
- RAP_API = 'https://rapapi.deno.dev/'
21
-
22
- last_rap_values = {
23
- "Abyssal Treasure Chest": None,
24
- "God Potion": None,
25
- "Huge Egg": None,
26
- "Winter God Potion": None
27
- }
28
-
29
- LIMITED_PETS = {
30
- "Huge Shiba": 15000,
31
- "Huge Dragon": 7500,
32
- "Huge Nightmare Corgi": 15000,
33
- "Huge Jelly Axolotl": 5000
34
- }
35
-
36
- JELLY_LEAVE_TIMES = {
37
- "Huge Pilgrim Turkey": datetime.strptime('2024-12-06 12:00:00', '%Y-%m-%d %H:%M:%S').replace(tzinfo=pytz.timezone('US/Eastern')),
38
- "Acorn": datetime.strptime('2024-12-06 12:00:00', '%Y-%m-%d %H:%M:%S').replace(tzinfo=pytz.timezone('US/Eastern'))
39
- }
40
-
41
- intents = discord.Intents.default()
42
- intents.message_content = True
43
- bot = commands.Bot(command_prefix='!', intents=intents)
44
-
45
- pet_images = {}
46
- pet_difficulties = {}
47
- pet_raps = {}
48
- pet_changes = defaultdict(deque)
49
- recent_notifications = defaultdict(deque)
50
-
51
- async def fetch_exists_data(session):
52
- try:
53
- async with session.get(EXISTS_API) as response:
54
- if response.status == 200:
55
- data = await response.json()
56
- return data.get('data', [])
57
- except Exception as e:
58
- print(f"Error fetching exists data: {e}")
59
- return []
60
-
61
- def format_number(number):
62
- if not isinstance(number, (int, float)):
63
- return str(number)
64
-
65
- abs_number = abs(number)
66
- if abs_number < 1000:
67
- return str(number)
68
- elif abs_number < 1000000:
69
- return f"{number/1000:.1f}k"
70
- elif abs_number < 1000000000:
71
- return f"{number/1000000:.1f}m"
72
- elif abs_number < 1000000000000:
73
- return f"{number/1000000000:.1f}b"
74
- else:
75
- return f"{number/1000000000000:.1f}t"
76
-
77
- async def fetch_pet_collection_data(session, pet_name):
78
- try:
79
- async with session.get('https://collectionpet.deno.dev') as response:
80
- if response.status == 200:
81
- data = await response.json()
82
- for pet in data.get('data', []):
83
- if pet.get('configName', '').lower() == pet_name.lower():
84
- return pet
85
- except Exception as e:
86
- print(f"Error fetching pet collection data: {e}")
87
- return None
88
-
89
- async def fetch_pet_exists_data(session, pet_name):
90
- try:
91
- async with session.get('https://biggamesexists.deno.dev') as response:
92
- if response.status == 200:
93
- data = await response.json()
94
- variants = {
95
- 'Normal': 0,
96
- 'Golden': 0,
97
- 'Rainbow': 0,
98
- 'Shiny': 0,
99
- 'Shiny Golden': 0,
100
- 'Shiny Rainbow': 0
101
- }
102
-
103
- for pet_data in data.get('data', []):
104
- config_data = pet_data.get('configData', {})
105
- value = pet_data.get('value', 0)
106
-
107
- pet_id = config_data.get('id', '')
108
- is_shiny = config_data.get('sh', False)
109
- pt_value = config_data.get('pt', 0)
110
-
111
- if pet_id.lower() == pet_name.lower():
112
- if is_shiny and pt_value == 1:
113
- variants['Shiny Golden'] = max(variants['Shiny Golden'], value)
114
- elif is_shiny and pt_value == 2:
115
- variants['Shiny Rainbow'] = max(variants['Shiny Rainbow'], value)
116
- elif is_shiny:
117
- variants['Shiny'] = max(variants['Shiny'], value)
118
- elif pt_value == 1:
119
- variants['Golden'] = max(variants['Golden'], value)
120
- elif pt_value == 2:
121
- variants['Rainbow'] = max(variants['Rainbow'], value)
122
- else:
123
- variants['Normal'] = max(variants['Normal'], value)
124
-
125
- return variants
126
- except Exception as e:
127
- print(f"Error fetching exists data: {e}")
128
- return None
129
-
130
- async def fetch_pet_rap_data(session, pet_name):
131
- try:
132
- print(f"Fetching RAP data for pet: {pet_name}")
133
- async with session.get('https://biggamesraps.deno.dev') as response:
134
- if response.status == 200:
135
- data = await response.json()
136
- print(f"RAP API Response status: {response.status}")
137
- print(f"RAP API Response data structure: {list(data.keys())}")
138
-
139
- variants = {
140
- 'Normal': 0,
141
- 'Golden': 0,
142
- 'Rainbow': 0,
143
- 'Shiny': 0,
144
- 'Shiny Golden': 0,
145
- 'Shiny Rainbow': 0
146
- }
147
-
148
- sample_data = list(data.get('data', []))[:2]
149
- print(f"Sample RAP data entries: {json.dumps(sample_data, indent=2)}")
150
-
151
- for pet_data in data.get('data', []):
152
- config_data = pet_data.get('configData', {})
153
- value = pet_data.get('value', 0)
154
-
155
- pet_id = config_data.get('id', '')
156
- print(f"Checking pet ID: {pet_id} against searched name: {pet_name}")
157
-
158
- if pet_id.lower() == pet_name.lower():
159
- is_shiny = config_data.get('sh', False)
160
- pt_value = config_data.get('pt', 0)
161
-
162
- print(f"Found matching pet. Shiny: {is_shiny}, PT Value: {pt_value}, RAP: {value}")
163
-
164
- if is_shiny and pt_value == 1:
165
- variants['Shiny Golden'] = max(variants['Shiny Golden'], value)
166
- elif is_shiny and pt_value == 2:
167
- variants['Shiny Rainbow'] = max(variants['Shiny Rainbow'], value)
168
- elif is_shiny:
169
- variants['Shiny'] = max(variants['Shiny'], value)
170
- elif pt_value == 1:
171
- variants['Golden'] = max(variants['Golden'], value)
172
- elif pt_value == 2:
173
- variants['Rainbow'] = max(variants['Rainbow'], value)
174
- else:
175
- variants['Normal'] = max(variants['Normal'], value)
176
-
177
- print(f"Final RAP values for {pet_name}: {variants}")
178
- return variants
179
- else:
180
- print(f"RAP API returned non-200 status code: {response.status}")
181
- return None
182
- except Exception as e:
183
- print(f"Error fetching RAP data: {e}")
184
- print(f"Full error traceback: {traceback.format_exc()}")
185
- return None
186
-
187
- @bot.command(name='petdata')
188
- async def pet_data(ctx, *, pet_name):
189
- async with aiohttp.ClientSession() as session:
190
- print(f"\n--- Starting pet data fetch for: {pet_name} ---")
191
-
192
- collection_data = await fetch_pet_collection_data(session, pet_name)
193
- print(f"Collection data fetched: {'Success' if collection_data else 'Failed'}")
194
-
195
- exists_data = await fetch_pet_exists_data(session, pet_name)
196
- print(f"Exists data fetched: {exists_data}")
197
-
198
- rap_data = await fetch_pet_rap_data(session, pet_name)
199
- print(f"RAP data fetched: {rap_data}")
200
-
201
- if not collection_data or not exists_data:
202
- await ctx.send("Pet does not exist!")
203
- return
204
-
205
- embed = discord.Embed(
206
- title=collection_data.get('configName', 'Unknown Pet'),
207
- color=int('11ff00', 16)
208
- )
209
-
210
- config_data = collection_data.get('configData', {})
211
-
212
- description = f"**Index Description:** {config_data.get('indexDesc', 'N/A')}\n"
213
-
214
- description += "**Pet Exists:**\n"
215
- total_exists = 0
216
-
217
- for variant, count in exists_data.items():
218
- if count > 0:
219
- rap_value = rap_data.get(variant, 0) if rap_data else 0
220
- rap_display = format_number(rap_value)
221
- description += f"{variant}: **{count:,}** (RAP: {rap_display})\n"
222
- total_exists += count
223
-
224
- description += f"\n**Total Exist: {total_exists:,}**"
225
-
226
- embed.description = description
227
-
228
- thumbnail_url = config_data.get('thumbnail')
229
- if thumbnail_url:
230
- if thumbnail_url.startswith('rbxassetid://'):
231
- asset_id = re.search(r'\d+', thumbnail_url.replace('rbxassetid://', '')).group(0)
232
- thumbnail_url = f"https://rbxgleaks.pythonanywhere.com/asset/{asset_id}"
233
-
234
- embed.set_image(url=thumbnail_url)
235
-
236
- print("--- Sending embed message ---")
237
- await ctx.send(embed=embed)
238
-
239
- @bot.command(name='commonhuges')
240
- async def common_huge_pets(ctx, count: int = 10):
241
- if ctx.author.id != AUTHORIZED_USER_ID:
242
- await ctx.send("You are not authorized to use this command.")
243
- return
244
-
245
- count = max(1, min(count, 25))
246
-
247
- async with aiohttp.ClientSession() as session:
248
- exists_data = await fetch_pet_exists_data(session, '')
249
- if not exists_data:
250
- await ctx.send("Could not retrieve pet data. Please try again later.")
251
- return
252
-
253
- huge_pet_counts = defaultdict(int)
254
-
255
- for pet_name, variants in exists_data.items():
256
- if pet_name.startswith('Huge'):
257
- for variant, count_value in variants.items():
258
- huge_pet_counts[f"{variant} {pet_name}"] = count_value
259
-
260
- sorted_huge_pets = sorted(huge_pet_counts.items(), key=lambda x: x[1], reverse=True)
261
-
262
- embed = discord.Embed(title=f"Top {count} Most Common Huge Pets", color=discord.Color.blue())
263
-
264
- if sorted_huge_pets:
265
- for i, (pet_name, count_value) in enumerate(sorted_huge_pets[:count], 1):
266
- embed.add_field(
267
- name=f"{i}. {pet_name}",
268
- value=f"Exists: **{format_number(count_value)}**",
269
- inline=False
270
- )
271
- else:
272
- embed.description = "No huge pets found in the data."
273
-
274
- await ctx.send(embed=embed)
275
-
276
- @bot.command(name='commontitanics')
277
- async def common_titanic_pets(ctx, count: int = 10):
278
- if ctx.author.id != AUTHORIZED_USER_ID:
279
- await ctx.send("You are not authorized to use this command.")
280
- return
281
-
282
- count = max(1, min(count, 25))
283
-
284
- async with aiohttp.ClientSession() as session:
285
- exists_data = await fetch_pet_exists_data(session, '')
286
- if not exists_data:
287
- await ctx.send("Could not retrieve pet data. Please try again later.")
288
- return
289
-
290
- titanic_pet_counts = defaultdict(int)
291
-
292
- for pet_name, variants in exists_data.items():
293
- if pet_name.startswith('Titanic'):
294
- for variant, count_value in variants.items():
295
- titanic_pet_counts[f"{variant} {pet_name}"] = count_value
296
-
297
- sorted_titanic_pets = sorted(titanic_pet_counts.items(), key=lambda x: x[1], reverse=True)
298
-
299
- embed = discord.Embed(title=f"Top {count} Most Common Titanic Pets", color=discord.Color.blue())
300
-
301
- if sorted_titanic_pets:
302
- for i, (pet_name, count_value) in enumerate(sorted_titanic_pets[:count], 1):
303
- embed.add_field(
304
- name=f"{i}. {pet_name}",
305
- value=f"Exists: **{format_number(count_value)}**",
306
- inline=False
307
- )
308
- else:
309
- embed.description = "No titanic pets found in the data."
310
-
311
- await ctx.send(embed=embed)
312
-
313
- @bot.command(name='leastcommonhuges')
314
- async def least_common_huge_pets(ctx, count: int = 10):
315
- if ctx.author.id != AUTHORIZED_USER_ID:
316
- await ctx.send("You are not authorized to use this command.")
317
- return
318
-
319
- count = max(1, min(count, 25))
320
-
321
- async with aiohttp.ClientSession() as session:
322
- exists_data = await fetch_pet_exists_data(session, '')
323
- if not exists_data:
324
- await ctx.send("Could not retrieve pet data. Please try again later.")
325
- return
326
-
327
- huge_pet_counts = defaultdict(int)
328
-
329
- for pet_name, variants in exists_data.items():
330
- if pet_name.startswith('Huge'):
331
- for variant, count_value in variants.items():
332
- huge_pet_counts[f"{variant} {pet_name}"] = count_value
333
-
334
- sorted_huge_pets = sorted(huge_pet_counts.items(), key=lambda x: x[1])
335
-
336
- embed = discord.Embed(title=f"Top {count} Least Common Huge Pets", color=discord.Color.dark_red())
337
-
338
- if sorted_huge_pets:
339
- for i, (pet_name, count_value) in enumerate(sorted_huge_pets[:count], 1):
340
- embed.add_field(
341
- name=f"{i}. {pet_name}",
342
- value=f"Exists: **{format_number(count_value)}**",
343
- inline=False
344
- )
345
- else:
346
- embed.description = "No huge pets found in the data."
347
-
348
- await ctx.send(embed=embed)
349
-
350
- @bot.command(name='leastcommontitanics')
351
- async def least_common_titanic_pets(ctx, count: int = 10):
352
- if ctx.author.id != AUTHORIZED_USER_ID:
353
- await ctx.send("You are not authorized to use this command.")
354
- return
355
-
356
- count = max(1, min(count, 25))
357
-
358
- async with aiohttp.ClientSession() as session:
359
- exists_data = await fetch_pet_exists_data(session, '')
360
- if not exists_data:
361
- await ctx.send("Could not retrieve pet data. Please try again later.")
362
- return
363
-
364
- titanic_pet_counts = defaultdict(int)
365
-
366
- for pet_name, variants in exists_data.items():
367
- if pet_name.startswith('Titanic'):
368
- for variant, count_value in variants.items():
369
- titanic_pet_counts[f"{variant} {pet_name}"] = count_value
370
-
371
- sorted_titanic_pets = sorted(titanic_pet_counts.items(), key=lambda x: x[1])
372
-
373
- embed = discord.Embed(title=f"Top {count} Least Common Titanic Pets", color=discord.Color.dark_red())
374
-
375
- if sorted_titanic_pets:
376
- for i, (pet_name, count_value) in enumerate(sorted_titanic_pets[:count], 1):
377
- embed.add_field(
378
- name=f"{i}. {pet_name}",
379
- value=f"Exists: **{format_number(count_value)}**",
380
- inline=False
381
- )
382
- else:
383
- embed.description = "No titanic pets found in the data."
384
-
385
- await ctx.send(embed=embed)
386
-
387
- def calculate_jelly_prediction(pet_name, current_value, hourly_rate):
388
- if pet_name not in JELLY_LEAVE_TIMES:
389
- return None
390
-
391
- current_time = datetime.now(pytz.timezone('US/Eastern'))
392
- leave_time = JELLY_LEAVE_TIMES[pet_name]
393
-
394
- if current_time >= leave_time:
395
- return None
396
-
397
- time_diff = leave_time - current_time
398
- hours_remaining = time_diff.total_seconds() / 3600
399
- predicted_increase = hourly_rate * hours_remaining
400
- predicted_final = current_value + predicted_increase
401
-
402
- return {
403
- 'predicted_value': int(predicted_final),
404
- 'hours_remaining': round(hours_remaining, 1)
405
  }
 
406
 
407
- def calculate_time_until_limited(pet_name, current_value, hourly_rate):
408
- if pet_name not in LIMITED_PETS or hourly_rate <= 0:
409
- return None
410
-
411
- limit = LIMITED_PETS[pet_name]
412
- remaining = limit - current_value
413
-
414
- if remaining <= 0:
415
- return "Already Limited!"
416
-
417
- hours = remaining / hourly_rate
418
- if hours < 0:
419
- return "Error calculating time"
420
-
421
- days = hours // 24
422
- remaining_hours = hours % 24
423
-
424
- if days > 0:
425
- return f"~{int(days)}d {int(remaining_hours)}h"
426
- else:
427
- return f"~{int(remaining_hours)}h"
428
-
429
- async def send_rap_change_notification(channel, item_name, previous_rap, current_rap):
430
- percent_change = ((current_rap - previous_rap) / previous_rap) * 100
431
-
432
- if current_rap > previous_rap:
433
- message = f"🚀 {item_name} RAP ROSE BY {percent_change:.2f}%!\n" + \
434
- f"Previous RAP: {previous_rap:,}\n" + \
435
- f"Current RAP: {current_rap:,}"
436
- await channel.send(message)
437
- else:
438
- message = f"📉 {item_name} RAP DROPPED BY {abs(percent_change):.2f}%!\n" + \
439
- f"Previous RAP: {previous_rap:,}\n" + \
440
- f"Current RAP: {current_rap:,}"
441
- await channel.send(message)
442
-
443
- async def update_rap_values(session):
444
- try:
445
- async with session.get(RAP_API) as response:
446
- if response.status == 200:
447
- data = await response.json()
448
- if data['status'] == 'ok':
449
- pet_raps.clear()
450
-
451
- monitored_channel = bot.get_channel(MONITORED_ITEMS_CHANNEL_ID)
452
- if monitored_channel:
453
- for pet_data in data['data']:
454
- config_data = pet_data['configData']
455
- pet_id = config_data['id']
456
- value = pet_data['value']
457
- is_shiny = config_data.get('sh', False)
458
-
459
- monitored_key = f"Shiny {pet_id}" if is_shiny else pet_id
460
-
461
- if monitored_key in last_rap_values:
462
- current_rap = value
463
- previous_rap = last_rap_values[monitored_key]
464
-
465
- if previous_rap is not None and current_rap != previous_rap:
466
- await send_rap_change_notification(monitored_channel, monitored_key, previous_rap, current_rap)
467
-
468
- last_rap_values[monitored_key] = current_rap
469
-
470
- if is_shiny:
471
- pet_raps[f"Shiny {pet_id}"] = value
472
- else:
473
- pet_raps[pet_id] = value
474
-
475
- print(f"Updated RAP values for {len(data['data'])} pets and items")
476
- except Exception as e:
477
- print(f"Error fetching RAP values: {e}")
478
-
479
- def calculate_hourly_rate(pet_name):
480
- if pet_name not in pet_changes:
481
- return 0
482
-
483
- changes = pet_changes[pet_name]
484
- if not changes:
485
- return 0
486
-
487
- current_time = datetime.now()
488
- one_hour_ago = current_time - timedelta(hours=1)
489
-
490
- recent_changes = [change for change in changes if change['timestamp'] > one_hour_ago]
491
-
492
- if not recent_changes:
493
- return 0
494
-
495
- if len(recent_changes) >= 2:
496
- earliest_value = recent_changes[0]['value']
497
- latest_value = recent_changes[-1]['value']
498
- return latest_value - earliest_value
499
-
500
- return 1
501
-
502
- async def get_huge_secret_pets(session):
503
- try:
504
- async with session.get(PETS_API) as response:
505
- if response.status == 200:
506
- data = await response.json()
507
- if data['status'] == 'ok':
508
- huge_secret_pets = []
509
-
510
- for pet in data['data']:
511
- config_data = pet['configData']
512
- if config_data.get('huge') or config_data.get('secret') or config_data.get('titanic'):
513
- pet_name = config_data['name']
514
- huge_secret_pets.append(pet_name)
515
- huge_secret_pets.append(f"Shiny {pet_name}")
516
-
517
- difficulty = config_data.get('difficulty', 'Unknown')
518
- pet_difficulties[pet_name] = difficulty
519
- pet_difficulties[f"Shiny {pet_name}"] = difficulty * 100
520
-
521
- if 'thumbnail' in config_data:
522
- pet_images[pet_name] = config_data['thumbnail']
523
- pet_images[f"Shiny {pet_name}"] = config_data['thumbnail']
524
- print(f"Stored image URL for {pet_name}: {config_data['thumbnail']}")
525
-
526
- for pet_name in huge_secret_pets:
527
- if pet_name not in pet_changes:
528
- pet_changes[pet_name] = deque(maxlen=100)
529
-
530
- print(f"Found {len(huge_secret_pets)} pets to track (including shiny versions)")
531
- return huge_secret_pets
532
- except Exception as e:
533
- print(f"Error fetching pets list: {e}")
534
- return []
535
-
536
- async def send_embed_message(channel, pet_name, previous_value, current_value, is_change=False):
537
- notification_key = f"{pet_name}_{previous_value}_{current_value}"
538
-
539
- if notification_key in recent_notifications.get(pet_name, []):
540
- print(f"Skipping duplicate notification for {pet_name}")
541
  return
542
-
543
- if pet_name not in recent_notifications:
544
- recent_notifications[pet_name] = deque(maxlen=5)
545
- recent_notifications[pet_name].append(notification_key)
546
-
547
- pet_image_url = pet_images.get(pet_name, None)
548
- difficulty = pet_difficulties.get(pet_name, "Unknown")
549
- rap_value = pet_raps.get(pet_name, "No RAP")
550
- hourly_rate = calculate_hourly_rate(pet_name)
551
-
552
- difficulty_display = format_number(difficulty) if isinstance(difficulty, (int, float)) else difficulty
553
- rap_display = format_number(rap_value) if isinstance(rap_value, (int, float)) else rap_value
554
- current_display = f"{current_value:,}" if isinstance(current_value, (int, float)) else current_value
555
- previous_display = format_number(previous_value) if isinstance(previous_value, (int, float)) else previous_value
556
- hourly_rate_display = format_number(hourly_rate) if isinstance(hourly_rate, (int, float)) else hourly_rate
557
-
558
- is_shiny = pet_name.startswith("Shiny ")
559
- base_name = pet_name.replace("Shiny ", "") if is_shiny else pet_name
560
-
561
- time_until_limited = None
562
- if base_name in LIMITED_PETS:
563
- time_until_limited = calculate_time_until_limited(base_name, current_value, hourly_rate)
564
-
565
- jelly_prediction = None
566
- if base_name in JELLY_LEAVE_TIMES:
567
- jelly_prediction = calculate_jelly_prediction(base_name, current_value, hourly_rate)
568
-
569
- value_change = current_value - previous_value if previous_value is not None else current_value
570
-
571
- if is_shiny:
572
- title = f"✨ {f'A **SHINY** {base_name} was' if value_change == 1 else f'{value_change} **SHINY** {base_name}s were'} rolled! ✨"
573
- embed_color = discord.Color.from_rgb(255, 255, 255)
574
- else:
575
- title = f"🎲 {f'A {pet_name}' if value_change == 1 else f'{value_change} {pet_name}s'} were rolled! 🎲"
576
- embed_color = discord.Color.blue() if not is_change else discord.Color.orange()
577
-
578
- description = f"{pet_name} exists: **{current_display}**\n" \
579
- f"Difficulty: **1 in {difficulty_display}**\n" \
580
- f"RAP Value: **{rap_display}**\n" \
581
- f"Hourly Rate: **{hourly_rate_display}/h**"
582
-
583
- if time_until_limited is not None:
584
- description += f"\nTime Remaining Until Limited: **{time_until_limited}**"
585
-
586
- if base_name in LIMITED_PETS:
587
- limit = LIMITED_PETS[base_name]
588
- remaining = limit - current_value
589
- if remaining > 0:
590
- description += f"\nQuantity Remaining: **{remaining:,}**"
591
 
592
- if jelly_prediction is not None:
593
- description += f"\nEstimated Final Count: **{jelly_prediction['predicted_value']:,}**"
594
- description += f"\nGoing Limited In: **{jelly_prediction['hours_remaining']}h**"
595
-
596
- embed = discord.Embed(
597
- title=title,
598
- description=description,
599
- color=embed_color
600
- )
601
-
602
- if pet_image_url:
603
- if isinstance(pet_image_url, str):
604
- if pet_image_url.startswith('rbxassetid://'):
605
- asset_id = re.search(r'^\d+', pet_image_url.replace('rbxassetid://', '')).group(0)
606
- pet_image_url = f"https://rbxgleaks.pythonanywhere.com/asset/{asset_id}"
607
-
608
- print(f"Using image URL for {pet_name}: {pet_image_url}")
609
- embed.set_thumbnail(url=pet_image_url)
610
-
611
- try:
612
- await channel.send(embed=embed)
613
- except discord.HTTPException as e:
614
- print(f"Failed to send embed for {pet_name}: {e}")
615
- await channel.send(f"🎲 {'A' if value_change == 1 else value_change} {pet_name} was rolled! Exists: {current_display} (Previous: {previous_display})")
616
-
617
- async def petdata(session, tracked_pets):
618
- try:
619
- async with session.get(EXISTS_API) as response:
620
- if response.status == 200:
621
- data = await response.json()
622
- if data['status'] == 'ok':
623
- pet_values = {pet: 0 for pet in tracked_pets}
624
-
625
- for pet in data['data']:
626
- pet_id = pet['configData']['id']
627
- is_shiny = pet['configData'].get('sh', False)
628
- value = pet['value']
629
-
630
- pet_name = f"Shiny {pet_id}" if is_shiny else pet_id
631
- if pet_name in pet_values:
632
- print(f"Found pet: {pet_name} with exist count {value}")
633
- pet_values[pet_name] = value
634
-
635
- return pet_values
636
- except Exception as e:
637
- print(f"Error fetching pet data: {e}")
638
- return None
639
-
640
- async def main_loop():
641
- channel = bot.get_channel(CHANNEL_ID)
642
- if channel is None:
643
- print("Invalid channel ID. Please check your channel ID.")
644
- return
645
-
646
- async with aiohttp.ClientSession() as session:
647
- tracked_pets = await get_huge_secret_pets(session)
648
- if not tracked_pets:
649
- print("No pets fetched, retrying in 60 seconds...")
650
- await asyncio.sleep(60)
651
- return
652
-
653
- lastknown = {pet: None for pet in tracked_pets}
654
- print(f"Initially tracking {len(tracked_pets)} pets")
655
-
656
- while True:
657
- try:
658
- await update_rap_values(session)
659
-
660
- vvalues = await petdata(session, tracked_pets)
661
- if vvalues is not None:
662
- for pet, value in vvalues.items():
663
- if lastknown[pet] is None:
664
- print(f"Initial value for {pet}: {value}")
665
- elif value != lastknown[pet]:
666
- pet_changes[pet].append({
667
- 'timestamp': datetime.now(),
668
- 'value': value,
669
- 'previous': lastknown[pet]
670
- })
671
- await send_embed_message(channel, pet, lastknown[pet], value, is_change=True)
672
- lastknown[pet] = value
673
- else:
674
- print("Broken check")
675
-
676
- new_pets = await get_huge_secret_pets(session)
677
- if new_pets and set(new_pets) != set(tracked_pets):
678
- print("Pet list updated!")
679
- tracked_pets = new_pets
680
- lastknown.update({pet: None for pet in tracked_pets if pet not in lastknown})
681
-
682
- await asyncio.sleep(60)
683
-
684
- except Exception as e:
685
- print(f"Error in main loop: {e}")
686
- await asyncio.sleep(60)
687
 
688
- @bot.event
689
- async def on_ready():
690
- print(f'Logged in as {bot.user.name}')
691
- bot.loop.create_task(main_loop())
692
 
693
- bot.run(TOKEN)
 
 
1
+ import time
2
+ import requests
3
+ import random
4
+ import string
5
+ from bs4 import BeautifulSoup
6
+
7
+ WEBHOOK_URL = "https://discord.com/api/webhooks/1332227337764212787/eiLDXO-dZsYhUsh60zW8ZUSOS5pymZlqXG5JbG2Q13eroYw4uABHVY9DSspMCukpA1pj"
8
+ BASE_URL = "https://discord.nfp.is/"
9
+ VIDEO_CHECK_INTERVAL = 1
10
+
11
+ def generate_random_string(length=3):
12
+ return ''.join(random.choices(string.ascii_letters, k=length))
13
+
14
+ def send_webhook_message(video_link):
15
+ data = {
16
+ "content": video_link
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
+ response = requests.post(WEBHOOK_URL, json=data)
19
 
20
+ if response.status_code != 204:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ def check_site_content(url, random_string):
24
+ try:
25
+ response = requests.get(url)
26
+ if response.status_code == 200:
27
+ soup = BeautifulSoup(response.content, 'html.parser')
28
+ pre_tag = soup.find('pre')
29
+ if pre_tag and random_string in pre_tag.text:
30
+ return True
31
+ return False
32
+ except requests.RequestException as e:
33
+ return False
34
+
35
+ def main():
36
+ while True:
37
+ try:
38
+ random_string = generate_random_string()
39
+ video_link = BASE_URL + random_string
40
+
41
+ if check_site_content(video_link, random_string):
42
+ send_webhook_message(video_link)
43
+ else:
44
+ print(f"this shit {video_link} does not exist")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ time.sleep(VIDEO_CHECK_INTERVAL)
47
+ except Exception as e:
48
+ print(f"error {e}")
 
49
 
50
+ if __name__ == "__main__":
51
+ main()