Fixed update checker behavior

This commit is contained in:
Profitroll 2023-03-22 21:26:05 +01:00
parent c600747848
commit 7f1f86ca03
1 changed files with 6 additions and 8 deletions

View File

@ -24,17 +24,15 @@ if (
exit()
if loadJson("config.json")["check_for_updates"]:
appendLog(f"Currently using YusarinBot v{str(version)}")
try:
release = loads(
get(
"https://git.end-play.xyz/api/v1/repos/profitroll/YusarinBot/releases?draft=false&pre-release=false&page=1&limit=1"
).json()
)[0]
if float(release["tag_name"].replace("v", "")) > version:
releases = get(
"https://git.end-play.xyz/api/v1/repos/profitroll/YusarinBot/releases?draft=false&pre-release=false&page=1&limit=1"
).json()
if float(releases[0]["tag_name"].replace("v", "")) > version:
appendLog(
f"YusarinBot version {release['tag_name']} is available. Download new version here: {release['html_url']}"
f"YusarinBot version {releases[0]['tag_name']} is available. Download new version here: {releases[0]['html_url']}"
)
appendLog(f"Currently using YusarinBot v{str(version)}")
except Exception as exp:
appendLog(
f"Could not get YusarinBot cloud version due to {exp}. Currently using {str(version)}"