Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
add subscribe command for notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
fredsmith committed May 29, 2015
1 parent 41e8803 commit 2dc449d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/notify.py
Expand Up @@ -9,3 +9,18 @@ def send_notification(self, build_id, text):
notification_list = self.load("notify_{}".format(build_id), '')
self.say("{} BuildID: {}, Message: {}".format(notification_list, build_id, text))

@respond_to("^subscribe (@?)(?P<user>\w*) to (?P<build_id>\w*)")
def subscribe(self, message, user, build_id):
"""
subscribe [user] to [buildid]: request to be notified when builds complete
"""
if user == "me":
user = message.sender.nick

notification_list = "{} @{}".format(
self.load("notify_" + build_id, ''),
user)
self.save('notify_{}'.format(build_id), notification_list)
self.say("OK, I'll tell {} when I hear about {}".format(', '.join(notification_list.replace("@", "").strip().split(" ")), build_id))


0 comments on commit 2dc449d

Please sign in to comment.