Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions cogs/utils/github.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import requests
from bs4 import BeautifulSoup

def get_latest():
response = requests.get("https://raw.github.com/r-liner/discord-commands-bot/master/version.txt")
Expand All @@ -13,9 +12,21 @@ def check_for_updates(version):
return False

def changelog():
latest = get_latest()
response = requests.get(f"https://github.com/r-liner/discord-commands-bot/releases/tag/v{latest}")
soup = BeautifulSoup(response.text, "html.parser")
_changelog = soup.find("div", class_="markdown-body my-3").get_text()
headers = {
"Accept": "application/vnd.github.v3.text+json",
}

response = requests.get(
"https://api.github.com/repos/liner-exe/discord-commands-bot/releases/latest",
headers=headers,
)

if not response.ok:
return ""

data = response.json()

if not data.get("body_text"):
return "" # Raise there error if needed

return _changelog
return data["body_text"]
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ nextcord==2.6.0
typing_extensions==4.9.0
psutil==5.9.8
requests==2.31.0
beautifulsoup4==4.12.3