diff --git a/Largs.py b/Largs.py index f56d79d..5f2643b 100644 --- a/Largs.py +++ b/Largs.py @@ -44,8 +44,24 @@ print(fb.read()) fb.close() if (sys.argv[1] == "update"): - print("Whoa!") - print("Excuse our mess. You've run into a feature that hasn't been implemented!") + url = 'https://github.com/Freakybob-Team/lb/blob/main/Largsupdate.py?raw=true' + response = requests.get(url) + file_Path = 'update.py' + if response.status_code == 200: + with open(file_Path, 'wb') as file: + file.write(response.content) + print('File downloaded successfully') + exec(open('update.py').read()) + else: + print('Failed to download file') + print("Trying another source...") + alturl = 'https://codeberg.org/Freakybob/lb/raw/branch/main/Largsupdate.py' + response = requests.get(alturl) + file_Path = 'update.py' + with open(file_Path, 'wb') as file: + file.write(response.content) + print('File downloaded successfully') + exec(open('update.py').read()) if (sys.argv[1] == "greg"): url = 'https://github.com/Freakybob-Team/lb/blob/main/greg.bat?raw=true' response = requests.get(url) diff --git a/Largsupdate.py b/Largsupdate.py new file mode 100644 index 0000000..72468b7 --- /dev/null +++ b/Largsupdate.py @@ -0,0 +1,27 @@ +import requests +import os +print("Welcome to the Update Wizard. This will update your current Largs version.") +url = 'https://github.com/Freakybob-Team/lb/blob/main/Largs.py?raw=true' +response = requests.get(url) +file_Path = "Largs.py" +response = requests.get(url) +if response.status_code == 200: + with open(file_Path, 'wb') as file: + file.write(response.content) + print('File downloaded successfully') +else: + print("Oops! There was an error and we couldn't download Largs.") + print("We're trying a different source...") + alturl = 'https://codeberg.org/Freakybob/lb/raw/branch/main/Largs.py' + response = requests.get(alturl) + file_Path = "Largs.py" + with open(file_Path, 'wb') as file: + file.write(response.content) + print('File downloaded successfully') +print("Done! Largs has been updated.") +wantremove = input("Do you want to delete update.py? (Yes/No) (Case-sensitive) ") +if (wantremove == "Yes"): + os.remove("Largsupdate.py") +else: + print("Okay! We have not deleted update.py.") +exec(open('Largs.py').read())