Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to add my own hooks for certain events? #23

Open
Taytay opened this issue Mar 3, 2015 · 6 comments
Open

Is there a way to add my own hooks for certain events? #23

Taytay opened this issue Mar 3, 2015 · 6 comments

Comments

@Taytay
Copy link

Taytay commented Mar 3, 2015

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?

@parkr
Copy link
Member

parkr commented Mar 4, 2015

Not presently, no.

What kind of API would you envision?

@patcon
Copy link
Member

patcon commented Mar 4, 2015

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..!

@Taytay
Copy link
Author

Taytay commented Mar 4, 2015

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.

@Taytay
Copy link
Author

Taytay commented Mar 4, 2015

Oh, and thanks for this project! Good stuff! :)

@niklasR
Copy link

niklasR commented Sep 22, 2017

@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.

@patcon
Copy link
Member

patcon commented Oct 6, 2017

Yeah, go for it! but please provide tests so we can merge easily :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants