aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason2016-08-23 11:10:58 -0600
committerjason2016-08-23 11:10:58 -0600
commitce73bb556051cb99db980545c3c2efb439f40e65 (patch)
treeec871d9eee3dfd89f91ff84edd4145700d16e2d4
parent4cfcd2f373ead1540d53e891df2c14b9a5bab19c (diff)
downloadwarmachine-ng-ce73bb556051cb99db980545c3c2efb439f40e65.tar.gz
warmachine-ng-ce73bb556051cb99db980545c3c2efb439f40e65.zip
Add a !standup-unignore command to remove users from the ignore list
-rw-r--r--warmachine/addons/standup.py33
1 files 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):
149 elif cmd == '!standup-ignore' and channel \ 149 elif cmd == '!standup-ignore' and channel \
150 and channel in self.standup_schedules: # noqa - indent level 150 and channel in self.standup_schedules: # noqa - indent level
151 if parts: 151 if parts:
152 users_to_ignore = ''.join(parts).split(' ') 152 users_to_ignore = parts
153 for u in users_to_ignore: 153 for u in users_to_ignore:
154 if u not in self.standup_schedules[channel]['ignoring']: 154 if u not in self.standup_schedules[channel]['ignoring']:
155 self.log.info('Ignoring {} in channel {}'.format( 155 self.log.info('Ignoring {} in channel {}'.format(
@@ -166,10 +166,37 @@ class StandUpPlugin(WarMachinePlugin):
166 166
167 await connection.say('Currently ignoring {}'.format(ignoring), 167 await connection.say('Currently ignoring {}'.format(ignoring),
168 channel) 168 channel)
169
170 # ======================================================================
171 # !standup-unignore <space separated users>
172 #
173 # Remove users from the ignore list.
174 # ======================================================================
169 elif cmd == '!standup-unignore' and channel \ 175 elif cmd == '!standup-unignore' and channel \
170 and channel in self.standup_schedules: # noqa - indent level 176 and channel in self.standup_schedules: # noqa - indent level
171 if not parts: 177 removed_users = [] # Used for the message
172 return 178
179 if parts:
180 users_to_unignore = parts
181 for u in users_to_unignore:
182 if u in self.standup_schedules[channel]['ignoring']:
183 self.log.info('Unignoring {} in channel {}'.format(
184 u, channel))
185 self.standup_schedules[channel]['ignoring'].remove(u)
186 removed_users.append(u)
187 self.save_schedule(connection)
188
189 if removed_users:
190 await connection.say('Removed {} from the ignore list'.format(
191 ', '.join(removed_users)), channel)
192
193 ignoring = ', '.join(
194 self.standup_schedules[channel]['ignoring'])
195 if not ignoring:
196 ignoring = 'no one'
197
198 await connection.say('Currently ignoring {}'.format(ignoring),
199 channel)
173 200
174 # ====================================================================== 201 # ======================================================================
175 # !standup-schedules 202 # !standup-schedules