]> us-delaporte.pagekite.me Git - matrix-chore-bot.git/commitdiff
Fixup
authorEdward Delaporte <edward@delaporte.us>
Sat, 28 Mar 2026 02:08:02 +0000 (21:08 -0500)
committerEdward Delaporte <edward@delaporte.us>
Sat, 28 Mar 2026 02:08:02 +0000 (21:08 -0500)
matrix_chore_bot/bot.py
matrix_chore_bot/db.py

index 6d0e502a246121e9bfcdc734672a240af3a4acf5..8a9e75585c63f8e39d3d6a6eec108d220f98ad23 100644 (file)
@@ -6,13 +6,11 @@ import simplematrixbotlib as botlib
 
 from .db import Data as ChoreData
 
 
 from .db import Data as ChoreData
 
-
 SERVER = os.environ.get('MATRIX_SERVER')
 BOT_NAME = os.environ.get('MATRIX_BOT')
 BOT_PWD = os.environ.get('MATRIX_BOT_PWD')
 SERVER = os.environ.get('MATRIX_SERVER')
 BOT_NAME = os.environ.get('MATRIX_BOT')
 BOT_PWD = os.environ.get('MATRIX_BOT_PWD')
-DATA_DIR = os.environ.get('MATRIX_DATA_DIR')
 
 
-CHORES = ChoreData(os.path.join(DATA_DIR}, 'chores.db'))
+CHORES = ChoreData()
 
 def get_bot():
     creds = botlib.Creds(SERVER, BOT_NAME, BOT_PWD)
 
 def get_bot():
     creds = botlib.Creds(SERVER, BOT_NAME, BOT_PWD)
index c2735e4a79f110c7c27c92f657d2204101ff0f86..315d2793682a5d8210d944c8f35bbe8bac0249ca 100644 (file)
@@ -8,8 +8,6 @@ from sqlmodel import Field, Session, SQLModel, create_engine, select, text
 # - [ ] add Vision FK
 # - [ ] add notes to each chore
 
 # - [ ] add Vision FK
 # - [ ] add notes to each chore
 
-CHORE_DB = os.environ.get('CHORE_DB')
-
 DATE_FORMAT = '%Y-%m-%d'
 
 def today():
 DATE_FORMAT = '%Y-%m-%d'
 
 def today():
@@ -38,7 +36,11 @@ def get_chore(session, chore_id):
     return session.exec(cmd).first()
 
 class Data():
     return session.exec(cmd).first()
 
 class Data():
-    def __init__(self, db_file = CHORE_DB):
+    def __init__(self, db_file=None):
+
+        if not db_file:
+            db_file = os.path.join(os.environ.get('MATRIX_DATA_DIR'), 'chores.db')
+
         self.file = db_file
         self.engine = self.get_engine()
 
         self.file = db_file
         self.engine = self.get_engine()