Move portraits ot a new method and then use that picture if you select the spawns for a single boss

This commit is contained in:
Luke Robles 2025-02-08 15:24:51 -08:00
parent beae4d9c4e
commit 080eff9b62
2 changed files with 18 additions and 9 deletions

View File

@ -147,10 +147,15 @@ class Tarkov(commands.Cog):
type="rich",
)
embed.set_author(name="🎲 Boss Spawn chances by map 🎲")
embed.set_thumbnail(url="https://i.ytimg.com/vi/Yis5rmgo_bM/maxresdefault.jpg")
if boss_name:
for item in tarkov.get_boss_pictures():
if item["name"] == boss_name:
embed.set_thumbnail(url=item["imagePortraitLink"])
break
embed.set_author(name=f"🎲 Spawn chance for {boss_name} 🎲")
embed.set_thumbnail(url="https://i.ytimg.com/vi/Yis5rmgo_bM/maxresdefault.jpg")
levels = tarkov.get_tarkov_boss_info()
@ -217,14 +222,7 @@ class Tarkov(commands.Cog):
# )
# break
portraits = tarkov.query_tarkov_api(
"""{
bosses(lang: en, gameMode:pve) {
name
imagePortraitLink
}
}"""
)["bosses"]
portraits = tarkov.get_boss_pictures()
for boss in portraits:
if boss["name"] == boss_name:

View File

@ -18,6 +18,17 @@ def query_tarkov_api(query):
).json()["data"]
def get_boss_pictures():
return query_tarkov_api(
"""{
bosses(lang: en, gameMode:pve) {
name
imagePortraitLink
}
}"""
)["bosses"]
def get_tarkov_boss_info():
"""
Returns a dict of boss spawn chances per map, and their escorts