]> apps.delaporte.us Git - matrix-goal-bot.git/blobdiff - bot.py
Update to complete goals
[matrix-goal-bot.git] / bot.py
diff --git a/bot.py b/bot.py
index b8f8f0c1120a600dc92ba62fb3dd20bff28f1aab..a6e7f65615c78ab051a406262d385fc60025c77d 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -40,7 +40,7 @@ async def do_goal(match):
     if match.command('add'):
         new = ' '.join(match.args()[1:])
         result = Data().add_goal(new)
-        return [result]
+        return [f'Goal added with id {result}']
 
     if match.command('list'):
         goals = Data().list_goals()
@@ -50,12 +50,15 @@ async def do_goal(match):
         return results
 
     if match.command('add-task'):
-        result = Data().add_task(goal_id=goal_id, name=name)
-        return [result]
+        goal_id = int(match.args()[1])
+        new = ' '.join(match.args()[2:])
+        result = Data().add_task(goal_id=goal_id, name=new)
+        return [f'Added task with id {result}']
 
     if match.command('print'):
-        goal_id = new = match.args()[1]
-        goal,tasks = Data().get_goal(id)
+        goal_id = int(match.args()[1])
+        logger.debug(f'Searching for goal {goal_id}...')
+        goal,tasks = Data().get_goal(goal_id)
 
         results = []
         results.append(f' ## {goal}')
@@ -65,8 +68,14 @@ async def do_goal(match):
             else:
                 results.append(f' - [ ] {task}')
         return results
+
+    if match.command('done'):
+        goal_id = int(match.args()[1])
+        logger.debug(f'Searching for goal {goal_id}...')
+        result = Data().complete_goal(goal_id)
+        return [result]
     
-    return 'Ye flask must be load bearing or something.'
+    return __doc__
 
 
 @bot.listener.on_message_event