diff --git a/src/constants.py b/src/constants.py index 5ad458c..7791bd4 100644 --- a/src/constants.py +++ b/src/constants.py @@ -1,5 +1,10 @@ import os +import sys + +token = os.getenv('TG_TOKEN', None) +if token is None: + print('Please configure your token in environment variable TG_TOKEN first.') + sys.exit(0) -token = os.environ['TG_TOKEN'] font = os.getenv('FONT', None) dbPath = 'database.json' diff --git a/src/scheduler.py b/src/scheduler.py index 5df4a3d..0a52f28 100644 --- a/src/scheduler.py +++ b/src/scheduler.py @@ -41,8 +41,6 @@ class Scheduler: # Function to update a single task def updateTask(cache: CacheEntry): - print("DEBUG: Sending request - %s" % cache.name, nowText) - request = self.database.reqs[cache.user][cache.name] if now - cache.time < request.get('interval', 120): return @@ -63,6 +61,8 @@ class Scheduler: cache.time = now if diff != '': + print("DEBUG: Diff detected - %s" % cache.name, nowText) + # Render diff doc = BytesIO(render(diff)) fileName = 'diff %s %s.png' % (cache.name, nowText) diff --git a/start.sh b/start.sh index 4e3ab4e..70d6861 100644 --- a/start.sh +++ b/start.sh @@ -1,4 +1,5 @@ source ./venv/bin/activate export PYTHONPATH=PYTHONPATH:$pwd export TG_TOKEN="Your token here" +export FONT="sarasa-mono-cl-regular" python3 ./src/bot.py