Query for the bosses name, not ID, makes for a nicer embed

This commit is contained in:
Luke Robles 2024-11-06 08:05:27 -08:00
parent 63255defc7
commit 99be368db3

View File

@ -177,7 +177,7 @@ class Tarkov(commands.Cog):
bosses{ bosses{
spawnChance spawnChance
boss{ boss{
id name
} }
} }
} }
@ -186,12 +186,11 @@ class Tarkov(commands.Cog):
dont_care = [ dont_care = [
"assault", "assault",
"ExUsec", "ExUsec",
"infectedAssault", "Infected",
"infectedCivil",
"infectedLaborant",
"infectedPmc", "infectedPmc",
"pmcBEAR", "BEAR",
"pmcUSEC", "USEC",
"Rogue",
] ]
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
response = tarkov.query_tarkov_api(query)["maps"] response = tarkov.query_tarkov_api(query)["maps"]
@ -200,9 +199,9 @@ class Tarkov(commands.Cog):
levels = {} levels = {}
for level in response: for level in response:
levels[level["name"]] = { levels[level["name"]] = {
boss["boss"]["id"]: boss["spawnChance"] boss["boss"]["name"]: boss["spawnChance"]
for boss in level["bosses"] for boss in level["bosses"]
if boss["boss"]["id"] not in dont_care if boss["boss"]["name"] not in dont_care
} }
for key, value in levels.items(): for key, value in levels.items():
@ -210,7 +209,7 @@ class Tarkov(commands.Cog):
name=key, name=key,
value="\n".join( value="\n".join(
f"{k}: **{str(round(v*100, 2))}%**" for k, v in value.items() f"{k}: **{str(round(v*100, 2))}%**" for k, v in value.items()
).replace("boss", ""), ),
inline=False, inline=False,
) )
embed.set_footer(text=f"Pulled from the api") embed.set_footer(text=f"Pulled from the api")