Fixed conflicts

This commit is contained in:
Twentysix
2016-01-21 14:33:18 +01:00
3 changed files with 144 additions and 31 deletions

View File

@@ -6,6 +6,9 @@ import glob
default_settings = ('{"TRIVIA_ADMIN_ONLY": false, "EDIT_CC_ADMIN_ONLY": false, "PASSWORD": "PASSWORDHERE", "FILTER": true, "CUSTOMCOMMANDS": true, ' +
'"TRIVIA_MAX_SCORE": 10, "TRIVIA_DELAY": 15, "LOGGING": true, "EMAIL": "EMAILHERE", "ADMINROLE": "Transistor", "DOWNLOADMODE" : true, ' +
'"VOLUME": 0.20, "TRIVIA_BOT_PLAYS" : false, "TRIVIA_TIMEOUT" : 120, "DEBUG_ID" : "IgnoreThis", "POLL_DURATION" : 60}')
default_apis = ('{"IMGFLIP_USERNAME": "USERNAMEHERE", "IMGFLIP_PASSWORD": "PASSWORDHERE", "MYAPIFILMS_TOKEN" : "TOKENHERE"}')
logger = logging.getLogger("__main__")
@@ -101,4 +104,22 @@ def createEmptyFiles():
new_settings["PASSWORD"] = password
new_settings["ADMINROLE"] = admin_role
fileIO("json/settings.json", "save", new_settings )
logger.info("Settings have been saved.")
logger.info("Settings have been saved.")
if not os.path.isfile("json/apis.json"):
logger.info("Missing apis.json. Creating it...\n")
fileIO("json/apis.json", "save", json.loads(default_apis))
print("\nIt's now time to configure optional services\nIf you're not interested, leave empty and keep pressing enter.\nMemes feature: create an account on https://imgflip.com/.\nimgflip username:")
imgflip_username = input(">")
print("Now enter the imgflip password.")
imgflip_password = input(">")
if imgflip_username == "": imgflip_username = "USERNAMEHERE"
if imgflip_password == "": password = "PASSWORDHERE"
print("\n!imdb configuration. Get your token here http://www.myapifilms.com/token.do\nOr just press enter if you're not interested.")
imdb_token = input(">")
if imdb_token == "": imdb_token = "TOKENHERE"
new_settings = json.loads(default_apis)
new_settings["IMGFLIP_USERNAME"] = imgflip_username
new_settings["IMGFLIP_PASSWORD"] = imgflip_password
new_settings["MYAPIFILMS_TOKEN"] = imdb_token
fileIO("json/apis.json", "save", new_settings )
logger.info("API Settings have been saved.\n")