]> us-delaporte.pagekite.me Git - matrix-goal-bot.git/blobdiff - bot.py
Add try/except
[matrix-goal-bot.git] / bot.py
diff --git a/bot.py b/bot.py
index 2891b821c391bac114bff25b3f68af19e9b039bf..d57358d09a4df26dc55ab9a92475ea595e50ec64 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -36,12 +36,13 @@ async def do_goal(match):
       add - add a goal
       add-task ID - add a task under the goal specified by ID
       add-vision - add a new vision (collection of goals)
       add - add a goal
       add-task ID - add a task under the goal specified by ID
       add-vision - add a new vision (collection of goals)
+      close-goal ID - mark goal done by ID
+      close-vision ID - mark vision as complete by ID
       done ID - mark task done by ID
       done ID - mark task done by ID
-      goal-done ID - mark goal done by ID
       list - list incomplete goals
       list-all - list everything
       list-done - list completed goals
       list - list incomplete goals
       list-all - list everything
       list-done - list completed goals
-      print ID - print a goal and all tasks
+      print GOAL_ID - print a goal and all tasks
       print-vision ID - print a vision and all goals
       set-vision GOAL_ID VISION_ID- associate GOAL_ID with VISION_ID
       visions - list incomplete visions
       print-vision ID - print a vision and all goals
       set-vision GOAL_ID VISION_ID- associate GOAL_ID with VISION_ID
       visions - list incomplete visions
@@ -100,13 +101,20 @@ async def do_goal(match):
         results = pretty_print(vision, goals)
         return results
 
         results = pretty_print(vision, goals)
         return results
 
-    if match.command('goal-done'):
+    if match.command('close-goal'):
         goal_id = int(match.args()[1])
         goal_id = int(match.args()[1])
-        Data().complete_goal(goal_id)
-        goal,tasks = Data().get_goal(goal_id)
-        results = pretty_print(goal, tasks)
+        vision_id = Data().complete_goal(goal_id)
+        vision,goals = Data().get_vision(vision_id)
+        results = pretty_print(vision, goals)
         return results
         return results
-    
+
+    if match.command('close-vision'):
+        vision_id = int(match.args()[1])
+        Data().complete_vision(vision_id)
+        vision,goals = Data().get_vision(vision_id)
+        results = pretty_print(vision, goals)
+        return results
+
 
     if match.command('done'):
         task_id = int(match.args()[1])
 
     if match.command('done'):
         task_id = int(match.args()[1])