Doing a trivia

This commit is contained in:
NikolajDanger
2020-04-06 14:37:10 +02:00
parent 2a27ef61de
commit a0451d5dbe
5 changed files with 128 additions and 118 deletions

View File

@ -9,47 +9,7 @@ import json
import funcs
# Creates swcharacters.json if it doesn't exist
try:
f = open("resources/swcharacters.json","r")
except:
funcs.logThis("swcharacters.json didn't exist. Making it now.")
emptyDict = {}
with open("resources/swcharacters.json","w") as f:
json.dump(emptyDict,f,indent = 4)
finally:
f.close()
# Creates trivia.json if it doesn't exist
try:
f = open("resources/trivia.json","r")
except:
funcs.logThis("trivia.json didn't exist. Making it now.")
data = {"questions":{},"users":{}}
with open("resources/trivia.json","w") as f:
json.dump(data,f,indent = 4)
finally:
f.close()
# Creates destinyPoints.txt if it doesn't exist
try:
f = open("resources/destinyPoints.txt","r")
except:
funcs.logThis("destinyPoints.txt didn't exist. Making it now.")
with open("resources/destinyPoints.txt","w") as f:
f.write("")
finally:
f.close()
# Creates token.txt
try:
f = open("token.txt","r")
except:
funcs.logThis("token.txt didn't exist. Write your bot token in the file.")
with open("resources/token.txt","w") as f:
f.write("Replace this line with bot token")
finally:
f.close()
funcs.makeFiles()
# Gets secret bot token
with open("token.txt","r") as f: