From 7f1f86ca03a1a7665c854d87e9300ddd4d1986e8 Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 22 Mar 2023 21:26:05 +0100 Subject: [PATCH] Fixed update checker behavior --- yusarin.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/yusarin.py b/yusarin.py index a088763..70b9966 100644 --- a/yusarin.py +++ b/yusarin.py @@ -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)}"