]> us-delaporte.pagekite.me Git - matrix-chore-bot.git/blobdiff - matrix_chore_bot/bot.py
Update to use MATRIX_DATA_DIR
[matrix-chore-bot.git] / matrix_chore_bot / bot.py
index a0a3256d025fc3b21640acadfb56ecf0c5f34f75..6d0e502a246121e9bfcdc734672a240af3a4acf5 100644 (file)
@@ -4,11 +4,15 @@ import os
 
 import simplematrixbotlib as botlib
 
-from .db import Data
+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')
+DATA_DIR = os.environ.get('MATRIX_DATA_DIR')
+
+CHORES = ChoreData(os.path.join(DATA_DIR}, 'chores.db'))
 
 def get_bot():
     creds = botlib.Creds(SERVER, BOT_NAME, BOT_PWD)
@@ -18,7 +22,6 @@ logger = logging.getLogger(__name__)
 logging.basicConfig(filename='matrix-chore-bot.log', encoding='utf-8', level=logging.DEBUG)
 logging.getLogger('nio').setLevel(logging.WARNING)
 
-@bot.listener.on_message_event
 async def chore_bot(room, message, bot):
     match = botlib.MessageMatch(room, message, bot, '!chore')
 
@@ -32,7 +35,7 @@ async def chore_bot(room, message, bot):
                 await bot.api.send_text_message(
                     room.room_id, str(line))
         except Exception as ex:
-            line = 'Ye cannot get ye flask.'
+            line = 'Ye flask must be load bearing, or something...'
             await bot.api.send_text_message(
                 room.room_id, str(line))