X-Git-Url: https://us-delaporte.pagekite.me/gitweb/matrix-goal-bot.git/blobdiff_plain/068e9eff44d867acaa64ee27b8874e13602912f8..418eb36e29d647190e80190c8c0b016f2ba7d2ab:/matrix_goal_bot/bot.py diff --git a/matrix_goal_bot/bot.py b/matrix_goal_bot/bot.py index 1a2bd2f..4bfce67 100644 --- a/matrix_goal_bot/bot.py +++ b/matrix_goal_bot/bot.py @@ -24,6 +24,7 @@ More commands: set.vision GOAL_ID VISION_ID- associate GOAL_ID with VISION_ID visions - list incomplete visions list.done - list completed goals + remove ID - remove a task by ID visionless - list goals with no set vision ''' @@ -71,13 +72,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}') @@ -107,8 +108,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...')