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