From: Edward Delaporte Date: Wed, 8 Apr 2026 23:07:14 +0000 (-0500) Subject: Fix for task removal X-Git-Url: https://us-delaporte.pagekite.me/gitweb/matrix-goal-bot.git/commitdiff_plain/8958d1dc084e3d468e8880cafa29652754e99875?ds=inline Fix for task removal --- diff --git a/matrix_goal_bot/bot.py b/matrix_goal_bot/bot.py index 417fca9..47c71a3 100644 --- a/matrix_goal_bot/bot.py +++ b/matrix_goal_bot/bot.py @@ -71,13 +71,13 @@ class GoalBot(): self.bot.run() async def handle_message(self, room, message): - logger.debug(f'Message: {message}') match = botlib.MessageMatch(room, message, self.bot, self.prefix) - if not match.is_not_from_this_bot() and match.prefix(): - logger.debug(f'Message: {message} was not for this bot.') + if not match.is_not_from_this_bot(): + # Let's not talk to our-self return + logger.debug(f'Message: {message}') if not match.prefix(): logger.debug(f'{message} - did not match {self.prefix}') diff --git a/matrix_goal_bot/db.py b/matrix_goal_bot/db.py index bc8cdbc..6421d2b 100644 --- a/matrix_goal_bot/db.py +++ b/matrix_goal_bot/db.py @@ -204,9 +204,14 @@ class Data(): def remove_task(self, task_id): task_name = '' + logger.debug(f'Removing task with id {task_id}') with Session(self.engine) as session: - cmd = select(Task).where(Task.id == task_id) + cmd = select(Task).where(Task.id == int(task_id)) to_remove = session.exec(cmd).first() + if not to_remove: + return f'Unable to find task with id {task_id}' + + logger.debug(f'Removing task with name {to_remove.name}') task_name = to_remove.name session.delete(to_remove) session.commit()