From 93faa045376a088c1dea51790c1c6dc89c669e6e Mon Sep 17 00:00:00 2001 From: Alastair Holland Date: Sun, 3 May 2020 14:54:47 +0100 Subject: [PATCH] Added more functionality to the settings --- README.md | 2 +- configure.py | 4 +++ lib/__pycache__/setup.cpython-36.pyc | Bin 1105 -> 3699 bytes lib/bot.py | 34 +++++++++---------- lib/configure.py | 5 --- lib/online.py | 1 + lib/setup.py | 49 ++++++++++++++++++++++++--- run.py | 5 ++- 8 files changed, 68 insertions(+), 32 deletions(-) create mode 100755 configure.py delete mode 100755 lib/configure.py diff --git a/README.md b/README.md index 5fc7b91..68b2b39 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ More functions listed below. ## Running the bot To run this bot, just start __run.py__ in Python3
-To change settings in this bot, run __setup.py__ in Python3 +To change settings in this bot, run __configure.py__ in Python3 ### Prerequisites You need __*Python 3.5.9*__+ and a stable internet connection in order to run this bot. diff --git a/configure.py b/configure.py new file mode 100755 index 0000000..e5593db --- /dev/null +++ b/configure.py @@ -0,0 +1,4 @@ +def configure(): + from lib import setup + setup.environment() +configure() \ No newline at end of file diff --git a/lib/__pycache__/setup.cpython-36.pyc b/lib/__pycache__/setup.cpython-36.pyc index 45c9e7efa2bae10ea98690416d58c893c14b9e28..0833d591b7d281e6f606b70e7bb27876f6cd473a 100755 GIT binary patch literal 3699 zcmbtV%WvDr87C=9rf6HX<2ZiANv7Rw9Pc_&9-Hkp&7+1Ns9V2aJL@gcZb55C7A=WX zhLmkFWKmR$9u__1Z&(xs3KV4Z#@(X9(w7ed+DjCocfy~Wh+5?C@O)RkHg>h z`=0ah{_wE*%fEd2>2IbKcPlRH5o;iltC(SDDXMup@s2cN5nVF8{AO za4Jy$QJv;#feuiE7O8nyjMYdvQjat`*j4%GL5>b})mV$PBfYDLl@8Z6|HoKM zb&Y=({A!%T&gfAgQjZ3rTvw%IlL}T%V4i=nuYm6Y`1I#rQDs+g z7wCAbpWX-zIu;ZoHN|%|Fpb9fNDs^?-&H3S;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?uesIDoZ|sY6_w*+twnmtqRHe=AkhA(b+4r0vpg ") overwrite = overwrite.lower() #Makes the input string lowercase @@ -14,7 +14,9 @@ def environment(): else: return #Exit function else: - settingsChoice = "12345" + settingsChoice = "" + for s in range(1, len(settingList)+1): + settingsChoice = settingsChoice + str(s) '''Gets information''' if str(settingList.index("Token")+1) in settingsChoice: @@ -73,9 +75,47 @@ def environment(): custom = "TRUE" else: custom = os.environ['CUSTOM'] + if str(settingList.index("Server Map")+1) in settingsChoice: + mapCheck = input("Do you have an online map on your server? (y/n) > ") + mapCheck = mapCheck.lower() + if mapCheck == "y" or mapCheck == "yes": + mapURL = input("What's the URL of the map? (Leave blank if you can't remember, you can set it later) > ") + if mapURL == "": + mapURL = "There is no URL set for the map" + else: + mapURL = input("There is no online map on this server") + else: + mapURL = os.environ['MAP'] + + if str(settingList.index("World Downloads")+1) in settingsChoice: + worldCheck = input("Do you have an online world download on your server? (y/n) > ") + worldCheck = worldCheck.lower() + if worldCheck == "y" or mapCheck == "yes": + worldURL = input("What's the URL of the download? (Leave blank if you can't remember, you can set it later) > ") + if worldURL == "": + worldURL = "There is no URL set for the download" + else: + worldURL = input("There is no online map on this server") + else: + worldURL = os.environ['DOWNLOAD'] + + if str(settingList.index("Anti Spam")+1) in settingsChoice: + spam = input("Stop users from spamming commands? (y/n) > ") + spam = spam.lower() + if spam == "y" or spam == "yes": + antiSpam = "TRUE" + else: + antiSpam = "FALSE" + else: + antiSpam = os.environ['ANTISPAM'] + + if str(settingList.index("Owner Name")+1) in settingsChoice: + owner = input("What's the name of the server owner? > ") + else: + owner = os.environ['ADMINNAME'] '''Concantinate into a string''' - data = "TOKEN={}\nSERVER={}\nPORT={}\nPREFIX={}\nCUSTOM={}".format(token,serverIP,port,commandPrefix,custom) #Sets the format of the data + data = "TOKEN={}\nSERVER={}\nPORT={}\nPREFIX={}\nCUSTOM={}\nMAP={}\nDOWNLOAD={}\nANTISPAM={}\nADMINNAME={}".format(token,serverIP,port,commandPrefix,custom,mapURL,worldURL,antiSpam,owner) #Sets the format of the data '''Write data to the .env file''' creds = open(".env", "w") @@ -96,5 +136,4 @@ def environment(): if tryAgain == "y" or tryAgain == "yes": environment() else: - return -environment() \ No newline at end of file + return \ No newline at end of file diff --git a/run.py b/run.py index 77f76ea..b69587a 100755 --- a/run.py +++ b/run.py @@ -4,13 +4,12 @@ def run(): librarySetup.checkLibraries() from lib import setup - from lib import bot - from lib import online + #from lib import online import os if not os.path.isfile('.env'): setup.environment() - os.system("python3 bot.py") + os.system("python3 lib/bot.py") run() \ No newline at end of file