]> us-delaporte.pagekite.me Git - matrix-chore-bot.git/blobdiff - app.py
Add invoke debug task to check db
[matrix-chore-bot.git] / app.py
diff --git a/app.py b/app.py
index ead7f4c99dc9ba8e0d6dc2151b5a2e0047e00061..682b96afefbe40273ef68b2ea1122f31c5adaeba 100644 (file)
--- a/app.py
+++ b/app.py
@@ -1,9 +1,28 @@
-from matrix_chore_bot.bot import get_bot, chore_bot
+import os
 
-bot = get_bot()
+from matrix_chore_bot.bot import ChoreBot
 
-@bot.listener.on_message_event
+kwargs = {}
+# How to connect to Matrix
+kwargs['matrix_server'] = os.environ.get('MATRIX_SERVER')
+kwargs['bot_name'] = os.environ.get('MATRIX_BOT')
+kwargs['bot_pwd'] = os.environ.get('MATRIX_BOT_PWD')
+
+# Prefix to listen for
+kwargs['bot_prefix'] = os.environ.get('MATRIX_BOT_PREFIX', '!chore')
+
+# Where to store data
+DATA_DIR = os.environ.get('MATRIX_DATA_DIR', '')
+DB_FILE = os.environ.get('MATRIX_DB_FILE', 'chore.db')
+kwargs['db_file'] = os.path.join(DATA_DIR, DB_FILE)
+
+print(kwargs)
+
+chore_bot = ChoreBot(**kwargs) 
+
+@chore_bot.bot.listener.on_message_event
 async def do_bot_stuff(room, message):
-    await chore_bot(room, message, bot)
+    '''Pass messages to our bot'''
+    await chore_bot.handle_message(room, message)
 
-bot.run()
+chore_bot.run()