forked from piair/MsRewards-Reborn
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 != "":
|
||||
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]
|
||||
|
9
main.py
9
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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user