Adding buy location back to the /ship command
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Luke Robles 2023-12-23 14:11:23 -08:00
parent 91a8597d40
commit 9c08863667
23 changed files with 25 additions and 25 deletions

0
.drone.yml Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.pre-commit-config.yaml Normal file → Executable file
View File

1
Makefile Normal file → Executable file
View File

@ -2,6 +2,7 @@ include .env
# https://github.com/psf/black/issues/1106#issuecomment-547230844
format:
chmod -R 755 ${PWD}
docker run --rm -ti -v ${PWD}:/tmp/python/app pyfound/black:latest_release sh -c "black /tmp/python"
clean:

0
README.md Normal file → Executable file
View File

0
app/animals.py Normal file → Executable file
View File

0
app/bot.py Normal file → Executable file
View File

0
app/cogs/actual_utils.py Normal file → Executable file
View File

0
app/cogs/animal_functions.py Normal file → Executable file
View File

0
app/cogs/markov.py Normal file → Executable file
View File

0
app/cogs/poll.py Normal file → Executable file
View File

0
app/cogs/server_utils.py Normal file → Executable file
View File

0
app/cogs/stable_diffusion.py Normal file → Executable file
View File

0
app/cogs/star_citizen.py Normal file → Executable file
View File

0
app/cogs/user_functions.py Normal file → Executable file
View File

0
app/get_from_reddit.py Normal file → Executable file
View File

49
app/star_citizen.py Normal file → Executable file
View File

@ -144,6 +144,16 @@ async def get_ship(ship_name):
description="-------", color=discord.Color.blue(), type="rich"
)
try:
item_uuid = (
soup.find("div", {"class": "infobox__label"}, string="UUID")
.findNext("div", {"class": "infobox__data"})
.text
)
except Exception:
item_uuid = "N/A"
embed.set_footer(text="item UUID: %s" % item_uuid)
try:
description = (
soup.find("section", {"class": "citizen-section-collapsible"})
@ -186,15 +196,6 @@ async def get_ship(ship_name):
ship_role = ""
embed.add_field(name="**Role**", value=ship_role)
try:
item_uuid = (
soup.find("div", {"class": "infobox__label"}, string="UUID")
.findNext("div", {"class": "infobox__data"})
.text
)
except Exception:
item_uuid = "N/A"
embed.set_footer(text="item UUID: %s" % item_uuid)
try:
ingame_price = requests.get(
@ -202,17 +203,16 @@ async def get_ship(ship_name):
).text
price_soup = BeautifulSoup(ingame_price, "html.parser")
table = price_soup.find("div", class_="pricetab").find_next("table")
price_table = price_soup.find("div", class_="pricetab").find_next("table")
second_row = table.find_all("tr")[1]
second_row = price_table.find_all("tr")[1]
ingame_price = (
second_row.find_all("td")[1].get_text(strip=True).replace(" ", ",")
)
price = "[%s](%s%s#Universe_availability)" % (
price = "[%s](https://finder.cstone.space/ShipShops1/%s)" % (
ingame_price,
wiki_url,
wiki_ship_name,
item_uuid,
)
if "Not available" in ingame_price:
@ -266,18 +266,17 @@ async def get_ship(ship_name):
pass
try:
buy_location = (
soup.find("span", {"id": "Universe_availability"})
.findNext("tbody")
.find_all("td", {"class", "Location smwtype_wpg"})
)
price_table = price_soup.find("div", class_="pricetab").find_next("table")
if len(buy_location):
embed.add_field(
name="**Buyable At**",
value=", ".join(str(x.text) for x in buy_location),
inline=True,
)
second_row = price_table.find_all("tr")[1]
buy_location = (
second_row.find_all("td")[0].get_text(strip=True).split("-")[-1]
)
embed.add_field(
name="**Buyable At**",
value=buy_location,
inline=True,
)
except Exception:
pass

0
dalebot-overview.py Normal file → Executable file
View File

0
helm/.helmignore Normal file → Executable file
View File

0
helm/Chart.yaml Normal file → Executable file
View File

0
helm/templates/_helpers.tpl Normal file → Executable file
View File

0
helm/templates/hpa.yaml Normal file → Executable file
View File

0
helm/templates/ingress.yaml Normal file → Executable file
View File