From 2efe8df593524fbf6b0544cf693f0ff4008a70ef Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect Date: Thu, 3 Apr 2025 23:32:35 +0200 Subject: [PATCH] simplified the fuckin version checks ffs --- bot.py | 25 ++++++++++++------------- locales/en.json | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/bot.py b/bot.py index 78aa864..9037b4e 100644 --- a/bot.py +++ b/bot.py @@ -173,7 +173,7 @@ def generate_sha256_of_current_file(): latest_version = "0.0.0" -local_version = "0.14.8.3.1" +local_version = "0.14.8.3.3" os.environ['gooberlocal_version'] = local_version @@ -195,24 +195,23 @@ def check_for_update(): print(f"{RED}{get_translation(LOCALE, 'invalid_server')}{RESET}") return None, None - if local_version == "0.0.0": - with open(LOCAL_VERSION_FILE, "w") as f: - f.write(latest_version) + if local_version == "0.0.0" or None: + print(f"{RED}I cant find the local_version variable! Or its been tampered with and its not an interger!{RESET}") + return + generate_sha256_of_current_file() gooberhash = latest_version_info.get("hash") - if gooberhash == currenthash: - if local_version < latest_version: - print(f"{YELLOW}{get_translation(LOCALE, 'new_version').format(latest_version=latest_version, local_version=local_version)}{RESET}") - print(f"{YELLOW}{get_translation(LOCALE, 'changelog').format(VERSION_URL=VERSION_URL)}{RESET}") - else: - print(f"{GREEN}{get_translation(LOCALE, 'latest_version')} {local_version}{RESET}") - print(f"{get_translation(LOCALE, 'latest_version2').format(VERSION_URL=VERSION_URL)}\n\n") - else: + if local_version < latest_version: + print(f"{YELLOW}{get_translation(LOCALE, 'new_version').format(latest_version=latest_version, local_version=local_version)}{RESET}") + print(f"{YELLOW}{get_translation(LOCALE, 'changelog').format(VERSION_URL=VERSION_URL)}{RESET}") + if local_version == latest_version: + print(f"{GREEN}{get_translation(LOCALE, 'latest_version')} {local_version}{RESET}") + print(f"{get_translation(LOCALE, 'latest_version2').format(VERSION_URL=VERSION_URL)}\n\n") + if gooberhash != currenthash: print(f"{YELLOW}{get_translation(LOCALE, 'modification_warning')}") print(f"{YELLOW}{get_translation(LOCALE, 'reported_version')} {local_version}{RESET}") print(f"{DEBUG}{get_translation(LOCALE, 'current_hash')} {currenthash}{RESET}") - check_for_update() def get_file_info(file_path): diff --git a/locales/en.json b/locales/en.json index f57c70f..d7e7961 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,5 +1,5 @@ { - "modification_warning": "Goober has been modified! Skipping server checks entirely...", + "modification_warning": "Goober has been modified! Any changes will be lost in an update!", "reported_version": "Reported Version:", "current_hash": "Current Hash:", "not_found": "is not found!",