dragon-bot/app/tarkov.py
Luke R 208394f6d6
All checks were successful
Build and push / changes (push) Successful in 4s
Build and push / Lint-Python (push) Successful in 7s
Build and push / Build-and-Push-Docker (push) Successful in 18s
Build and push / sync-argocd-app (push) Successful in 3s
Change the dollar sign to AUEC sign for star citizen, also remove palworld rcon pass env var
2024-07-07 08:27:11 -07:00

24 lines
684 B
Python
Executable File

from bs4 import BeautifulSoup
import requests
import random
def request_wiki(url, heading):
response = requests.get(
"https://escapefromtarkov.fandom.com/wiki/Category:" + url, timeout=25
).text
soup = BeautifulSoup(response, "html.parser")
h2_heading = soup.find("h2", string=f'Pages in category "{heading}"')
return [link.text for link in h2_heading.find_next("div").find_all("a")]
def allowed_level_roll():
message = "None"
allowed = random.randint(0, 1) == 1
if allowed:
message = "Allowed"
message += ", Trader level: " + random.choice(
[str(random.randint(1, 4)), "Any level"]
)
return message