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

output issue urls when they are mentioned in chat #1

Open
benwtr opened this issue Nov 23, 2016 · 1 comment
Open

output issue urls when they are mentioned in chat #1

benwtr opened this issue Nov 23, 2016 · 1 comment

Comments

@benwtr
Copy link
Member

benwtr commented Nov 23, 2016

totally untested, just wrote this here, probably won't work on the first try:

robot.hear /(?:gh|github) issue #(\d+)(?: in ([\w\d-_]+)(?:\/([\w\d-_]+))?)?/i, id:'gh-issues.mention', (msg) ->
  id = msg.match[1]
    repo = if msg.match[2]? and msg.match[3]?
    "#{msg.match[2]}/#{msg.match[3]}"
  else if msg.match[2]?
    "#{DEFAULT_OWNER}/#{msg.match[2]}"
  else
    "#{DEFAULT_OWNER}/#{DEFAULT_REPO}"
  robot.ghissues.showIssue msg, id, repo

So you should then be able to mention issues in a chat:

User> So I says to Mabel, I says check out gh issue #4832742 in hubot-scripts/hubot-gh-issues
Hubot> Issue #4832742 in hubot-scripts/hubot-gh-issues - foo - https://github.com/hubot-scripts/hubot-gh-issues/issue/4832742
@benwtr
Copy link
Member Author

benwtr commented Nov 24, 2016

One problem here is users that aren't authenticated. There could be a default "bot" credential for this, or it could only work for authenticated users. I think option 2 is better.

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

1 participant