File size: 2,642 Bytes
a372ce3
 
 
 
840e6c2
 
 
a372ce3
 
 
 
 
 
 
 
840e6c2
a372ce3
 
 
840e6c2
 
 
a372ce3
840e6c2
 
 
a372ce3
840e6c2
 
 
a372ce3
840e6c2
a372ce3
840e6c2
 
a372ce3
 
 
 
 
 
 
 
 
 
 
 
840e6c2
 
 
 
 
a372ce3
840e6c2
a372ce3
840e6c2
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
import discord
from discord import app_commands
import aiohttp

@app_commands.command(name="petsimgo", description="get info on pet on petsgo u")
async def petsimgo(interaction: discord.Interaction, petname: str):
    await interaction.response.defer()

    async def fetch_data(url):
        async with aiohttp.ClientSession() as session:
            async with session.get(url) as response:
                if response.status == 200:
                    return await response.json()
                return None

    exists_data = await fetch_data("https://petsgo.biggamesapi.io/api/exists")
    rap_data = await fetch_data("https://petsgo.biggamesapi.io/api/Rap")
    collection_data = await fetch_data("https://petsgo.biggamesapi.io/api/collection/Pets")

    if not exists_data or not rap_data or not collection_data:
        await interaction.followup.send("error")
        return

    pet_exists = next((pet for pet in exists_data['data'] if pet['configData']['id'].lower() == petname.lower()), None)
    pet_rap = next((pet for pet in rap_data['data'] if pet['configData']['id'].lower() == petname.lower()), None)
    pet_info = next((pet for pet in collection_data['data'] if pet['configName'].lower() == petname.lower()), None)

    if not pet_exists or not pet_rap or not pet_info:
        await interaction.followup.send(f"Pet '{petname}' not found.")
        return

    exists_value = pet_exists['value']
    rap_value = pet_rap['value']
    thumbnail_id = pet_info['configData']['thumbnail'].split('://')[1]
    
    thumbnail_url = f"https://api.rbxgleaks1.workers.dev/asset/{thumbnail_id}"

    def format_difficulty(difficulty):
        if difficulty >= 1_000_000_000:
            return f"{difficulty / 1_000_000_000:.1f}B ({difficulty:,})"
        elif difficulty >= 1_000_000:
            return f"{difficulty / 1_000_000:.1f}M ({difficulty:,})"
        elif difficulty >= 1_000:
            return f"{difficulty / 1_000:.1f}K ({difficulty:,})"
        else:
            return f"{difficulty} ({difficulty:,})"

    embed = discord.Embed(title=f"PetsGo: {pet_info['configData']['name']}", color=0x787878)
    embed.add_field(name="value", value=f"{rap_value:,} diamonds", inline=True)
    embed.add_field(name="existing", value=f"{exists_value:,}", inline=True)
    embed.add_field(name="difficulty", value=format_difficulty(pet_info['configData']['difficulty']), inline=True)
    embed.add_field(name="category", value=pet_info['category'], inline=True)
    embed.set_thumbnail(url=thumbnail_url)
    embed.set_footer(text="hello everyone can i please get a burrito now")

    await interaction.followup.send(embed=embed)