Add boss portraits
All checks were successful
Build and push / changes (push) Successful in 4s
Build and push / Lint-Python (push) Successful in 6s
Build and push / Build-and-Push-Docker (push) Successful in 1m16s
Build and push / sync-argocd-app (push) Successful in 2s

This commit is contained in:
Luke R 2024-11-03 18:18:22 -08:00
parent 84421f2cae
commit 0b457ab7f2
3 changed files with 19 additions and 1 deletions

View File

@ -5,6 +5,11 @@ import discord
import os
import random
import requests
import requests_cache
requests_cache.install_cache(
"request-cache", backend="sqlite", expire_after=300, allowable_methods=("GET",)
)
intents = discord.Intents.default()
intents.message_content = True

View File

@ -241,7 +241,19 @@ class Tarkov(commands.Cog):
response = requests.get(wiki_url + boss_name).text
soup = BeautifulSoup(response, "html.parser")
embed.set_thumbnail(url=soup.find("a", class_="image").get("href"))
portraits = tarkov.query_tarkov_api(
"""{
bosses(lang: en, gameMode:pve) {
name
imagePortraitLink
}
}"""
)["bosses"]
for boss in portraits:
if boss["name"] == boss_name:
embed.set_thumbnail(url=boss["imagePortraitLink"])
break
health = soup.find("table", class_="wikitable").find_next("td").text.rstrip()
embed.add_field(name="Health", value=health, inline=False)

View File

@ -10,6 +10,7 @@ markovify
openai
owotext
requests
requests-cache
wifi-qrcode-generator
wolframalpha
yfinance