Verified Commit 620a6e3a authored by A. Wilcox's avatar A. Wilcox 🦊
Browse files

IRC: Add issue reporting functionality

parent 193d7465
......@@ -6,7 +6,7 @@ from PyIRC.signal import event
from PyIRC.util.version import VERSIONSTR
from emily import config
from emily.core import push_event, merge_event, pipe_event
from emily.core import push_event, merge_event, pipe_event, issue_open_event, issue_close_event
class IRCNetwork(IRCProtocol):
......@@ -39,6 +39,8 @@ class IRC:
push_event.add(self.push)
merge_event.add(self.merge)
pipe_event.add(self.pipe)
issue_open_event.add(self.issue_open)
issue_close_event.add(self.issue_close)
myconf = config['irc']
self.networks = [network.strip()
......@@ -138,3 +140,15 @@ class IRC:
msg = '\x02{}\x02: Pipeline #{} for branch \x02{}\x02 status: {} - {}'
msg = msg.format(project, pipe['id'], pipe['branch'], pipe['status'], pipe['url'])
self._send_to_proj_channels(project, [msg])
def issue_common(self, project, issue, action):
msg = '\x02{}\x02: {} {} issue #{} (\x02{}\x02): {}'
msg = msg.format(project, issue['user']['name'], action, issue['id'], issue['title'],
issue['url'])
self._send_to_proj_channels(project, [msg])
def issue_open(self, project, issue):
self.issue_common(project, issue, 'filed')
def issue_close(self, project, issue):
self.issue_common(project, issue, 'closed')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment