More config...
This commit is contained in:
parent
71482713d5
commit
36a112a1dd
@ -58,11 +58,15 @@ def update_config(key, value):
|
|||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def get_config():
|
def get_config(check_for=False):
|
||||||
# Returns a config file, creating one if not existing.
|
# Returns a config file, creating one if not existing.
|
||||||
if os.path.exists("config.json"):
|
if os.path.exists("config.json"):
|
||||||
with open("config.json") as f:
|
with open("config.json") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
if check_for:
|
||||||
|
for i in check_for:
|
||||||
|
if i not in config:
|
||||||
|
config = create_config()
|
||||||
else:
|
else:
|
||||||
config = create_config()
|
config = create_config()
|
||||||
return config
|
return config
|
||||||
|
@ -32,7 +32,7 @@ def start_bot(default=True):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
conf = config.get_config()
|
conf = config.get_config(check_for=['dropbox_refresh_token', 'twitter_access_token_secret'])
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1].lower() == 'start':
|
if sys.argv[1].lower() == 'start':
|
||||||
@ -53,7 +53,8 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
first_tweet_id = start_bot(default=False)
|
first_tweet_id = start_bot(default=False)
|
||||||
else:
|
else:
|
||||||
print('Exiting...')
|
print('\nExiting...\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
conf = config.get_config()
|
conf = config.get_config()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user