X-Git-Url: https://us-delaporte.pagekite.me/gitweb/matrix-goal-bot.git/blobdiff_plain/e653a07c23fa77ce2d47e73d3bdd3a72fa1ea57e..913b65b598c1a233cce4f69724b4aca8ca6ef02a:/matrix_goal_bot/bot.py diff --git a/matrix_goal_bot/bot.py b/matrix_goal_bot/bot.py index dd0a789..37cb90d 100644 --- a/matrix_goal_bot/bot.py +++ b/matrix_goal_bot/bot.py @@ -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]