From 779ec1fd4f4d24b1b1eb5585178a6245b7a09e8a Mon Sep 17 00:00:00 2001 From: MxMarx <ruby.e.marx@gmail.com> Date: Sat, 23 Sep 2023 15:34:59 -0700 Subject: [PATCH] If replying to a message, use it for the reminder text --- maubot.yaml | 2 +- reminder/bot.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/maubot.yaml b/maubot.yaml index d25d305..11a7e7d 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.4.1 id: org.bytemarx.reminder -version: 0.1.1 +version: 0.1.2 license: AGPL-3.0-or-later modules: - reminder diff --git a/reminder/bot.py b/reminder/bot.py index 41043d8..5b7a4e0 100644 --- a/reminder/bot.py +++ b/reminder/bot.py @@ -122,13 +122,15 @@ class ReminderBot(Plugin): room: if true, ping the whole room cron: crontab syntax every: is the reminder recurring? - start_time: - message: + start_time: can be explicitly specified with a semicolon: !remind <start_time>; <message> + message: contains both the start_time and the message if not using a semicolon to separate them again: """ date_str = None reply_to_id = evt.content.get_reply_to() + reply_to = None user_info = await self.db.get_user_info(evt.sender) + # Determine is the agenda command was used instead of creating a subcommand so [room] can still be used agenda = evt.content.body[1:].startswith(self.agenda_command) if agenda: @@ -166,6 +168,11 @@ class ReminderBot(Plugin): else: # If no arguments are supplied, return the help message await evt.reply(self._help_message()) return + + # If the reminder was created by replying to a message, use that message's text + if reply_to_id and not message: + message = reply_to.content["body"] + reminder = Reminder( bot=self, room_id=evt.room_id, -- GitLab