diff --git a/V5.py b/V5.py index 7fa5e94..9707d3c 100755 --- a/V5.py +++ b/V5.py @@ -930,6 +930,9 @@ elif UNBAN: elif POINTS_FILE != "": save_points_from_file(POINTS_FILE) else: + if UPDATE_VERSION != None: + if DISCORD_ENABLED_ERROR: + webhookFailure.send(f"Updated to {UPDATE_VERSION}") for cred in Credentials: _mail = cred[0] _password = cred[1] diff --git a/main.py b/main.py index 73ccb5b..1097ec1 100644 --- a/main.py +++ b/main.py @@ -154,31 +154,32 @@ def proxy() : edit_config_txt("port",port) -def check_update(): +def check_update(args): try : latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"] latest = parse_version(latest) except Exception as e : print(e) - return () + return (args) f = open("./version", 'r') txt = f.readlines()[0].replace("\n","") f.close() cur = parse_version(txt) if not (cur < latest) : print("Already up to date.") + return(args) else : print(f"updating to {latest}") os.system("git reset --hard") os.system("git pull") os.system("python3 -m pip install -r requirements.txt > update.result") print(f"updated to {latest}") - + return(args + f" --verion {latest}") LogPath = config["PATH"]["logpath"] if LogPath == "/your/path/to/loginandpass.csv" : setup() else : args = " ".join(sys.argv[1::]) - check_update() + args = check_update(args) os.system("python3 V5.py " + args) diff --git a/modules/config.py b/modules/config.py index 5450e23..ec2d672 100644 --- a/modules/config.py +++ b/modules/config.py @@ -81,6 +81,12 @@ parser.add_argument( default="None" ) +parser.add_argument( + "--updated", + help="display a message on discord to tell that the bot have been updated", + dest="update_version", + default="None" +) args = parser.parse_args() CUSTOM_START = args.override @@ -93,7 +99,7 @@ if CUSTOM_START : VNC_ENABLED = args.vnc != "None" VNC_PORT = args.vnc POINTS_FILE = args.points_file - +UPDATE_VERSION = args.update_version # global variables used later in the code LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things START_TIME = time() diff --git a/version b/version index 32bc952..67617da 100644 --- a/version +++ b/version @@ -1 +1 @@ -v5.3.0 +v5.3.1