]> apps.delaporte.us Git - matrix-goal-bot.git/blobdiff - matrix_goal_bot/bot.py
Rebasing
[matrix-goal-bot.git] / matrix_goal_bot / bot.py
index dd0a7896e94b8815c760d9ffd4bdaafb7e913261..37cb90db1a418f2b7a0bbc3c99717b2064687d86 100644 (file)
@@ -10,9 +10,6 @@ SERVER = os.environ.get('MATRIX_SERVER')
 BOT_NAME = os.environ.get('GOAL_BOT')
 BOT_PWD = os.environ.get('GOAL_BOT_PWD')
 
-def get_bot():
-    creds = botlib.Creds(SERVER, BOT_NAME, BOT_PWD)
-    return botlib.Bot(creds)
 
 DATE_FORMAT = '%Y-%m-%d'
 
@@ -79,7 +76,7 @@ async def do_goal(match):
 
     if match.command('task'):
         new = ' '.join(match.args()[1:])
-        result = Data().quick_add_task(new)
+        goal_id  = Data().quick_add_task(new)
         goal,tasks = Data().get_goal(goal_id)
         results = pretty_print(goal, tasks)
         return results
@@ -177,6 +174,11 @@ async def do_goal(match):
         results = pretty_print(goal, tasks)
         return results
 
+    if match.command('remove'):
+        task_id  = int(match.args()[1])
+        result = Data().remove_task(task_id)
+        return [result]
+
     if match.command('extra.help'):
         return [ex_help]