From 400410476648bbd8ca8b0ff9237b09e12c7a083e Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 11 Jan 2019 22:05:29 +1000 Subject: [PATCH] better commenting, handle missing config.json fields --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 560df61..085b065 100755 --- a/main.py +++ b/main.py @@ -13,6 +13,13 @@ import requests scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses", "read:notifications"] cfg = json.load(open('config.json', 'r')) +#config.json *MUST* contain the instance URL, and the CW text. if they're not provided, we'll fall back to defaults. +if 'site' not in cfg: + cfg['website'] = "https://botsin.space" +if 'cw' not in cfg: + cfg['cw'] = "" + +#if the user is using a (very!) old version that still uses the .secret files, migrate to the new method if os.path.exists("clientcred.secret"): print("Upgrading to new storage method") cc = open("clientcred.secret").read().split("\n")