X-Git-Url: https://apps.delaporte.us/gitweb/matrix-goal-bot.git/blobdiff_plain/8e699b9e8768fedfc04203d639fd03144c2b617e..bb2167326768f12f708e1e0d94979bdd5066d86f:/matrix_goal_bot/bot.py diff --git a/matrix_goal_bot/bot.py b/matrix_goal_bot/bot.py index 9b630f8..8c8183c 100644 --- a/matrix_goal_bot/bot.py +++ b/matrix_goal_bot/bot.py @@ -4,7 +4,7 @@ import os import simplematrixbotlib as botlib -from goals.db import Data, pretty_print +from .db import Data, pretty_print SERVER = os.environ.get('MATRIX_SERVER') BOT_NAME = os.environ.get('GOAL_BOT') @@ -116,7 +116,6 @@ async def do_goal(match): results = pretty_print(vision, goals) return results - if match.command('done'): task_id = int(match.args()[1]) goal_id = Data().complete_task(task_id) @@ -143,6 +142,15 @@ async def do_goal(match): results.append(item) return results + if match.command('visions'): + items = Data().visionless() + results = ['# Goals with no vision'] + if not items: + results.append('-- No visionless goals --') + + for item in items: + results.append(item) + return results if match.command('set-vision'): goal_id = int(match.args()[1]) @@ -154,7 +162,7 @@ async def do_goal(match): return [do_goal.__doc__] -async def goal_bot(room, message): +async def goal_bot(room, message, bot): match = botlib.MessageMatch(room, message, bot, PREFIX) if not match.is_not_from_this_bot() and match.prefix(): @@ -167,6 +175,8 @@ async def goal_bot(room, message): await bot.api.send_text_message( room.room_id, str(line)) except Exception as ex: - return ['Ye cannot get ye flask.'] - + line ='Ye cannot get ye flask.' + await bot.api.send_text_message( + room.room_id, str(line)) +