File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 11import requests
2- from bs4 import BeautifulSoup
32
43def get_latest ():
54 response = requests .get ("https://raw.githubusercontent.com/r-liner/discord-commands-bot/master/version.txt" )
@@ -13,9 +12,21 @@ def check_for_updates(version):
1312 return False
1413
1514def changelog ():
16- latest = get_latest ()
17- response = requests .get (f"https://github.com/r-liner/discord-commands-bot/releases/tag/v{ latest } " )
18- soup = BeautifulSoup (response .text , "html.parser" )
19- _changelog = soup .find ("div" , class_ = "markdown-body my-3" ).get_text ()
15+ headers = {
16+ "Accept" : "application/vnd.github.v3.text+json" ,
17+ }
18+
19+ response = requests .get (
20+ "https://api.github.com/repos/liner-exe/discord-commands-bot/releases/latest" ,
21+ headers = headers ,
22+ )
23+
24+ if not response .ok :
25+ return ""
26+
27+ data = response .json ()
28+
29+ if not data .get ("body_text" ):
30+ return "" # Raise there error if needed
2031
21- return _changelog
32+ return data [ "body_text" ]
Original file line number Diff line number Diff line change @@ -3,4 +3,3 @@ nextcord==2.6.0
33typing_extensions == 4.9.0
44psutil == 5.9.8
55requests == 2.31.0
6- beautifulsoup4 == 4.12.3
You can’t perform that action at this time.
0 commit comments