Add boss portraits
This commit is contained in:
parent
ae72504a7d
commit
eafbb1fa77
@ -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
|
||||
|
@ -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)
|
||||
|
@ -10,6 +10,7 @@ markovify
|
||||
openai
|
||||
owotext
|
||||
requests
|
||||
requests-cache
|
||||
wifi-qrcode-generator
|
||||
wolframalpha
|
||||
yfinance
|
Loading…
x
Reference in New Issue
Block a user