ndaversa / hubot-jira-bot

Lets you search for JIRA tickets, open them, transition them thru different states, comment on them, rank them up or down, start or stop watching them or change who is assigned to a ticket. Also, notifications for assignments, mentions and watched tickets.
https://www.npmjs.com/package/hubot-jira-bot
MIT License
61 stars 43 forks source link

Is there a way to access Jira classes from outside of JiraBot? #23

Closed jfreedman closed 7 years ago

jfreedman commented 7 years ago

Hi,

More of a question than an issue. In my hubot script I am listening for the JiraWebhookTicketInReview. When the event fires, I'd like to use some of the classes you have under /jira to do some additional custom functionality.

I am pretty new to nodejs and hubot and haven't been able to find a way to make this work. Are those submodules (assuming my term is right) available for me to use via require or some other way?

Module.exports = (robot) -> robot.on "JiraWebhookTicketInReview", (ticket, transition, room, includeAttachment = no) => console.log 'here' bot = require('hubot-jira-bot')

can't find a way to get access to jira classes from here

ndaversa commented 7 years ago

@jfreedman you could do something like this:

Jira = require( "./node_modules/hubot-jira-bot/src/jira" );

note the path to your node_modules would be relative to the file you do the require from

Then you could do things like

Jira.Create.with(params go here)