Skip to content
Permalink
Browse files
Added custom code backup
  • Loading branch information
hollan84 committed May 3, 2020
1 parent 58af3ab commit dc02368709d3255fb785223dae86bc154cd98ffc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
@@ -1,2 +1,5 @@
.env
nicknames/
Custom.py

nicknames/
oldCustom/
@@ -48,7 +48,7 @@ async def on_message(message):
elif message.content.startswith('?map'):
msg = "http://map.alastairserver.co.uk"
elif message.content.startswith('?servername'):
msg = "http://minecraft.alastairserver.co.uk \nhttp://server.alastairserver.co.uk"
msg = os.environ['SERVER']
elif message.content.startswith('?help'):
msg = "Commands: \n - ?help \n - ?servername \n - ?map\n - ?status\n - ?minecraftNickname [USERNAME] [NICKNAME]\n - ?download"
elif message.content.startswith('?download'):
@@ -45,9 +45,11 @@ def environment():
newCustom = input("Do you want to overwrite the current custom file? (y/n) > ")
newCustom = newCustom.lower()
if newCustom == "y" or newCustom == "yes":
oldFile = open("customCode.py", "r")
oldFile = open("Custom.py", "r")
oldCode = oldFile.read()
oldFile.close()
if not os.path.exists("oldCustom"):
os.makedirs("oldCustom")
x = 0
copied = False
while copied == False:
@@ -58,17 +60,17 @@ def environment():
copied = True
x = x + 1
template = open("templates/customTemplate.py", "r")
customFile = open("customCode.py", "w")
customFile = open("Custom.py", "w")
customFile.write(template.read())
customFile.close()
template.close()
else:
template = open("templates/customTemplate.py", "r")
customFile = open("customCode.py", "w")
customFile.write(template.read())
customFile.close()
template.close()
custom = "TRUE"
else:
template = open("templates/customTemplate.py", "r")
customFile = open("Custom.py", "w")
customFile.write(template.read())
customFile.close()
template.close()
custom = "TRUE"
else:
custom = os.environ['CUSTOM']

0 comments on commit dc02368

Please sign in to comment.