X-Git-Url: https://apps.delaporte.us/gitweb/matrix-goal-bot.git/blobdiff_plain/d89a17b1ca0db37e8c6bdfae8a506f8aa33e2d82..2dfb9318625f70fd6838068d133e3dfe00000ac4:/matrix_goal_bot/bot.py diff --git a/matrix_goal_bot/bot.py b/matrix_goal_bot/bot.py index 9e15be4..417fca9 100644 --- a/matrix_goal_bot/bot.py +++ b/matrix_goal_bot/bot.py @@ -89,6 +89,11 @@ class GoalBot(): room.room_id, str(line)) except Exception as ex: logger.warn(f'Caught exception: {str(ex)}') + dumb_msg_idx = len(str(ex)) % len(snark) + dumb_msg = snark[dumb_msg_idx] + await self.bot.api.send_text_message( + room.room_id, dumb_msg) + await self.bot.api.send_text_message( room.room_id, str(ex)) @@ -102,8 +107,15 @@ class GoalBot(): if match.command('add'): new = ' '.join(match.args()[1:]) - result = self.data.add_goal(new) - return [f'Goal added with id {result}'] + goal_id = self.data.add_goal(new) + results = [f'Goal added with id {goal_id}'] + + goals = self.data.get_all_goals() + results.append('# Goals list...') + for goal in goals: + results.append(str(goal)) + + return results if match.command('list'): logger.debug('Asked to list goals...')