hubot-archive / hubot-pager-me

PagerDuty integration for Hubot

Home Page:https://www.npmjs.com/package/hubot-pager-me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`hubot pager incident` matches multiple listeners

technicalpickles opened this issue · comments

I noticed this while refactoring some other things:

Hubot> /pager incident 234
234: 2015-09-30T20:38:50Z test - @technicalpickles - assigned to 

I couldn't determine exactly which schedule you meant by incident. Can you be more specific?

I think it's just a matter of doing msg.finish() in the incident listener.

I played with this in the debugger, I believe this is because this is triggering both:

robot.respond /(pager|major)( me)? incident (.*)$/i, (msg)
...
robot.respond /pager( me)? (.+) (\d+)$/i, (msg)

If I run the command over and over I do not always get the same order of the responders picking up. The former is the one that it should trigger and the latter is either too inclusive of a regex or needs to explicitly short circuit on calls that come from 'pager incident 123'.

However after implementing the suggested fix (PR #72) I cannot reproduce at all. I am still learning, could you help me understand why this would be?

Fixed with #72