X-Git-Url: https://us-delaporte.pagekite.me/gitweb/matrix-chore-bot.git/blobdiff_plain/67be6c948b582842dcb0e0a24b0c6eacde226bfa..b602bd00cf0d253cc1d035333a39f0e884120bc5:/app.py diff --git a/app.py b/app.py index ead7f4c..682b96a 100644 --- 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()