Add boss portraits

This commit is contained in:
Luke Robles 2024-11-03 18:18:22 -08:00
parent ae72504a7d
commit eafbb1fa77
3 changed files with 19 additions and 1 deletions

View File

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

View File

@ -241,7 +241,19 @@ class Tarkov(commands.Cog):
response = requests.get(wiki_url + boss_name).text response = requests.get(wiki_url + boss_name).text
soup = BeautifulSoup(response, "html.parser") 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() health = soup.find("table", class_="wikitable").find_next("td").text.rstrip()
embed.add_field(name="Health", value=health, inline=False) embed.add_field(name="Health", value=health, inline=False)

View File

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