the passage to 5.3 wasn't justified ( at least not enough) so i added a new feature
This commit is contained in:
parent
a22d1e6ddb
commit
c51c463338
3
V5.py
3
V5.py
|
@ -930,6 +930,9 @@ elif UNBAN:
|
||||||
elif POINTS_FILE != "":
|
elif POINTS_FILE != "":
|
||||||
save_points_from_file(POINTS_FILE)
|
save_points_from_file(POINTS_FILE)
|
||||||
else:
|
else:
|
||||||
|
if UPDATE_VERSION != None:
|
||||||
|
if DISCORD_ENABLED_ERROR:
|
||||||
|
webhookFailure.send(f"Updated to {UPDATE_VERSION}")
|
||||||
for cred in Credentials:
|
for cred in Credentials:
|
||||||
_mail = cred[0]
|
_mail = cred[0]
|
||||||
_password = cred[1]
|
_password = cred[1]
|
||||||
|
|
9
main.py
9
main.py
|
@ -154,31 +154,32 @@ def proxy() :
|
||||||
edit_config_txt("port",port)
|
edit_config_txt("port",port)
|
||||||
|
|
||||||
|
|
||||||
def check_update():
|
def check_update(args):
|
||||||
try :
|
try :
|
||||||
latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"]
|
latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"]
|
||||||
latest = parse_version(latest)
|
latest = parse_version(latest)
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
print(e)
|
print(e)
|
||||||
return ()
|
return (args)
|
||||||
f = open("./version", 'r')
|
f = open("./version", 'r')
|
||||||
txt = f.readlines()[0].replace("\n","")
|
txt = f.readlines()[0].replace("\n","")
|
||||||
f.close()
|
f.close()
|
||||||
cur = parse_version(txt)
|
cur = parse_version(txt)
|
||||||
if not (cur < latest) :
|
if not (cur < latest) :
|
||||||
print("Already up to date.")
|
print("Already up to date.")
|
||||||
|
return(args)
|
||||||
else :
|
else :
|
||||||
print(f"updating to {latest}")
|
print(f"updating to {latest}")
|
||||||
os.system("git reset --hard")
|
os.system("git reset --hard")
|
||||||
os.system("git pull")
|
os.system("git pull")
|
||||||
os.system("python3 -m pip install -r requirements.txt > update.result")
|
os.system("python3 -m pip install -r requirements.txt > update.result")
|
||||||
print(f"updated to {latest}")
|
print(f"updated to {latest}")
|
||||||
|
return(args + f" --verion {latest}")
|
||||||
|
|
||||||
LogPath = config["PATH"]["logpath"]
|
LogPath = config["PATH"]["logpath"]
|
||||||
if LogPath == "/your/path/to/loginandpass.csv" :
|
if LogPath == "/your/path/to/loginandpass.csv" :
|
||||||
setup()
|
setup()
|
||||||
else :
|
else :
|
||||||
args = " ".join(sys.argv[1::])
|
args = " ".join(sys.argv[1::])
|
||||||
check_update()
|
args = check_update(args)
|
||||||
os.system("python3 V5.py " + args)
|
os.system("python3 V5.py " + args)
|
||||||
|
|
|
@ -81,6 +81,12 @@ parser.add_argument(
|
||||||
default="None"
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
CUSTOM_START = args.override
|
CUSTOM_START = args.override
|
||||||
|
@ -93,7 +99,7 @@ if CUSTOM_START :
|
||||||
VNC_ENABLED = args.vnc != "None"
|
VNC_ENABLED = args.vnc != "None"
|
||||||
VNC_PORT = args.vnc
|
VNC_PORT = args.vnc
|
||||||
POINTS_FILE = args.points_file
|
POINTS_FILE = args.points_file
|
||||||
|
UPDATE_VERSION = args.update_version
|
||||||
# global variables used later in the code
|
# global variables used later in the code
|
||||||
LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things
|
LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things
|
||||||
START_TIME = time()
|
START_TIME = time()
|
||||||
|
|
Loading…
Reference in New Issue