hubot-github-repo-event-notifier
hubot-github-repo-event-notifier copied to clipboard
Is there a way to add my own hooks for certain events?
I'd like to be able to respond to these events with some scripts of my own. From what I can tell, there isn't a way to add my own handler methods, is there?
Hey @Taytay! (Beat me to it, @parkr :)
Couldn't we emit a github-event-received
action with an event type arg and let people set up listeners?
EDIT: Actually @parkr, you're right to ask "what would you like to do?" first..!
You could indeed! ;) In fact, that's what I'm doing now in my local fork:
if eventType in eventTypes
# Emit the event for other scripts to handle
robot.emit "github-repo-event", {
data : data,
eventType : eventType
room : room
}
announceRepoEvent data, eventType, (what) ->
robot.messageRoom room, what
It's been easy to work with so far.
Oh, and thanks for this project! Good stuff! :)
@Taytay @parkr - would it be worth opening a PR for the robot.emit
?
My use would be to automatically create a new JIRA ticket when an issue is raised, and since hubot already knows about all this, it'd be very handy to make use of it.
Yeah, go for it! but please provide tests so we can merge easily :)