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 1
1
import requests
2
- from bs4 import BeautifulSoup
3
2
4
3
def get_latest ():
5
4
response = requests .get ("https://raw.githubusercontent.com/r-liner/discord-commands-bot/master/version.txt" )
@@ -13,9 +12,21 @@ def check_for_updates(version):
13
12
return False
14
13
15
14
def 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
20
31
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
3
3
typing_extensions == 4.9.0
4
4
psutil == 5.9.8
5
5
requests == 2.31.0
6
- beautifulsoup4 == 4.12.3
You can’t perform that action at this time.
0 commit comments