From ce73bb556051cb99db980545c3c2efb439f40e65 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 23 Aug 2016 11:10:58 -0600 Subject: Add a !standup-unignore command to remove users from the ignore list --- warmachine/addons/standup.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/warmachine/addons/standup.py b/warmachine/addons/standup.py index aa7fda6..27cee53 100644 --- a/warmachine/addons/standup.py +++ b/warmachine/addons/standup.py @@ -149,7 +149,7 @@ class StandUpPlugin(WarMachinePlugin): elif cmd == '!standup-ignore' and channel \ and channel in self.standup_schedules: # noqa - indent level if parts: - users_to_ignore = ''.join(parts).split(' ') + users_to_ignore = parts for u in users_to_ignore: if u not in self.standup_schedules[channel]['ignoring']: self.log.info('Ignoring {} in channel {}'.format( @@ -166,10 +166,37 @@ class StandUpPlugin(WarMachinePlugin): await connection.say('Currently ignoring {}'.format(ignoring), channel) + + # ====================================================================== + # !standup-unignore + # + # Remove users from the ignore list. + # ====================================================================== elif cmd == '!standup-unignore' and channel \ and channel in self.standup_schedules: # noqa - indent level - if not parts: - return + removed_users = [] # Used for the message + + if parts: + users_to_unignore = parts + for u in users_to_unignore: + if u in self.standup_schedules[channel]['ignoring']: + self.log.info('Unignoring {} in channel {}'.format( + u, channel)) + self.standup_schedules[channel]['ignoring'].remove(u) + removed_users.append(u) + self.save_schedule(connection) + + if removed_users: + await connection.say('Removed {} from the ignore list'.format( + ', '.join(removed_users)), channel) + + ignoring = ', '.join( + self.standup_schedules[channel]['ignoring']) + if not ignoring: + ignoring = 'no one' + + await connection.say('Currently ignoring {}'.format(ignoring), + channel) # ====================================================================== # !standup-schedules -- cgit v1.2.1