Skip to content
Permalink
Browse files

Added some comments

  • Loading branch information...
hollan84 committed May 3, 2020
1 parent 5c52f8c commit 9aebe3fa3bbdd0a8d2cc535fcf6e1d0b56797a02
Showing with 30 additions and 9 deletions.
  1. +11 −2 lib/librarySetup.py
  2. +16 −3 lib/setup.py
  3. +3 −4 run.py
@@ -3,25 +3,34 @@ def checkLibraries():
import getpass
import os

'''Check to see if pip3 is installed'''
try:
os.system("pip3 -V")
except:
os.system("sudo apt install python3-pip")

'''Check discord.py'''
try:
import discord
except:
try:
os.system("python3 -m pip install -U discord.py")
os.system("python3 -m pip install -U discord.py") #Linux/Mac OS
except:
os.system("py3 -m pip install -U discord.py")
os.system("py3 -m pip install -U discord.py") #Windows

'''Check mcstatus'''
try:
import mcstatus
except:
os.system("pip3 install mcstatus")

'''Check status'''
try:
import status
except:
os.system("pip3 install status")

'''Check dotenv'''
try:
import dotenv
except:
@@ -9,20 +9,22 @@ def environment():
if overwrite == "y" or overwrite == "yes":
print("\nChoose settings to change")
for i in settingList:
print("{} - {}".format((settingList.index(i)+1), i))
print("{} - {}".format((settingList.index(i)+1), i)) #Lists all the options to set
settingsChoice = input("\nInput the numbers of the settings you want to change\nYou can change multiple numbers by typing more than one (Example: 12345)\n > ")
else:
return #Exit function
else:
else: #If the environment file has not been set
settingsChoice = ""
for s in range(1, len(settingList)+1):
for s in range(1, len(settingList)+1): #Goes through all the options and selects all of them to set
settingsChoice = settingsChoice + str(s)

'''Gets information'''
if str(settingList.index("Token")+1) in settingsChoice:
token = input("Input your bot token here > ")
else:
token = os.environ['TOKEN']

'''Sets the IP/address of the server'''
if str(settingList.index("Server address/IP")+1) in settingsChoice:
serverIP = input("Input your server address/IP here > ")
differentIP = input("Is this different from the public URL/IP? (y/n) > ")
@@ -34,18 +36,24 @@ def environment():
else:
serverIP = os.environ['SERVER']
externalIP = os.environ['EXTSERVER']

'''Sets the port used for the minecraft server'''
if str(settingList.index("Port")+1) in settingsChoice:
port = input("Input your bot port here (If you don't know it, leave blank) > ")
if port == "":
port = "25565" #Default Minecraft server port
else:
port = os.environ['PORT']

'''Sets the prefix for the command usage'''
if str(settingList.index("Command Prefix")+1) in settingsChoice:
commandPrefix = input("If you want a custom command prefix, enter is here (Default is '?' - Leave bank for default)> ")
if commandPrefix == "":
commandPrefix = "?"
else:
commandPrefix = os.environ['PREFIX']

'''Sets the option for the custom file'''
if str(settingList.index("Custom File")+1) in settingsChoice:
customFile = input("Would you like a custom file to add your code to? (y/n) > ")
customFile = customFile.lower()
@@ -82,6 +90,8 @@ def environment():
custom = "TRUE"
else:
custom = os.environ['CUSTOM']

'''Sets the URL for the server map'''
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()
@@ -94,6 +104,7 @@ def environment():
else:
mapURL = os.environ['MAP']

'''Set the world download URL'''
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()
@@ -106,6 +117,7 @@ def environment():
else:
worldURL = os.environ['DOWNLOAD']

'''Sets the anti-spam variable'''
if str(settingList.index("Anti Spam")+1) in settingsChoice:
spam = input("Stop users from spamming commands? (y/n) > ")
spam = spam.lower()
@@ -116,6 +128,7 @@ def environment():
else:
antiSpam = os.environ['ANTISPAM']

'''Sets the name of the server owner'''
if str(settingList.index("Owner Name")+1) in settingsChoice:
owner = input("What's the name of the server owner? > ")
else:
7 run.py
@@ -1,15 +1,14 @@
def run():

from lib import librarySetup
librarySetup.checkLibraries()
librarySetup.checkLibraries() #Check and install libraries

from lib import setup
#from lib import online
import os


if not os.path.isfile('.env'):
if not os.path.isfile('.env'): #Initial setup
setup.environment()

os.system("python3 lib/bot.py")
os.system("python3 lib/bot.py") #Run main program
run()

0 comments on commit 9aebe3f

Please sign in to comment.
You can’t perform that action at this time.