Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zach van Rijn
Emily
Commits
620a6e3a
Verified
Commit
620a6e3a
authored
Apr 28, 2022
by
A. Wilcox
🦊
Browse files
IRC: Add issue reporting functionality
parent
193d7465
Changes
1
Hide whitespace changes
Inline
Side-by-side
emily/out/irc.py
View file @
620a6e3a
...
...
@@ -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'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment