diff options
author | Roger Gonzalez <roger@rogs.me> | 2022-08-09 11:48:09 -0300 |
---|---|---|
committer | Roger Gonzalez <roger@rogs.me> | 2022-08-09 11:48:09 -0300 |
commit | ef6904243dd60c4ac08aa543fd6661d512267ffd (patch) | |
tree | c1681dcb2455d8f0b7fe834923783993fecf944f | |
parent | dae5518b43a2bdd06d6545448fb936bbc77caad4 (diff) |
Sending keyword to the todo creator
-rw-r--r-- | bot.py | 7 | ||||
-rw-r--r-- | org.py | 4 |
2 files changed, 6 insertions, 5 deletions
@@ -31,10 +31,11 @@ async def todo(room, message): bot: TODO added! """ match = botlib.MessageMatch(room, message, bot, PREFIX) - if match.is_not_from_this_bot() and match.prefix() and match.command("todo"): + if match.is_not_from_this_bot() and match.prefix(): user = message.sender + keyword = str(message).split()[1].replace("!", "").lower() - if user == MATRIX_USERNAME: + if user == MATRIX_USERNAME and keyword in ["todo", "repeat", "next", "waiting", "someday", "proj"]: message = " ".join(message.body.split(" ")[1:]) room_id = room.room_id splitted_message = message.split("-") @@ -54,7 +55,7 @@ async def todo(room, message): todo_extra = "" print(f"Room: {room_id}, User: {user}, Message: {message}") - OrgData().add_new_todo(todo_title, todo_objective, todo_extra) + OrgData().add_new_todo(keyword, todo_title, todo_objective, todo_extra) await bot.api.send_text_message(room_id, "TODO added!") @@ -18,14 +18,14 @@ class OrgData(NextCloudConnection): today_hour = today.strftime("%H:%M") return f"{today_ymd} {today_day} {today_hour}" - def add_new_todo(self, description: str, outcome: str, extra: str) -> None: + def add_new_todo(self, keyword: str, description: str, outcome: str, extra: str) -> None: self.client.download_file(ORG_CAPTURE_FILENAME, "./capture.org") today = self._generate_today() todo_template = f""" -** TODO {description} :NEW::BOT: +** {keyword.upper()} {description} :NEW::BOT: Desired outcome: {outcome} :LOGBOOK: - Added: [{today}] |