the passage to 5.3 wasn't justified ( at least not enough) so i added a new feature

This commit is contained in:
piair 2023-04-07 10:01:47 +02:00
parent a22d1e6ddb
commit c51c463338
4 changed files with 16 additions and 6 deletions

3
V5.py
View File

@ -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]

View File

@ -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)

View File

@ -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()

View File

@ -1 +1 @@
v5.3.0
v5.3.1