|
20 | 20 | # Author:
|
21 | 21 | # @commadelimited
|
22 | 22 |
|
23 |
| -codes = [100, 101, 200, 201, 202, 204, 206, 207, 300, 301, 303, 304, 305, 307, 400, 401, 402, 403, 404, |
24 |
| - 405, 406, 408, 409, 410, 411, 413, 414, 416, 417, 418, 422, 423, 424, 425, 426, 429, 431, 444, |
25 |
| - 450, 500, 502, 503, 506, 507, 508, 509, 599] |
| 23 | +codes = ['100', '101', '200', '201', '202', '204', '206', '207', '300', '301', '303', '304', |
| 24 | + '305', '307', '400', '401', '402', '403', '404', '405', '406', '408', '409', '410', |
| 25 | + '411', '413', '414', '416', '417', '418', '422', '423', '424', '425', '426', '429', |
| 26 | + '431', '444', '450', '500', '502', '503', '506', '507', '508', '509', '599'] |
26 | 27 |
|
27 | 28 | module.exports = (robot) ->
|
28 |
| - robot.respond /httpcat (\d{3})/i, (msg) -> |
29 |
| - status = msg.match[1] |
30 |
| - |
31 |
| - if (codes.indexOf(status)) |
| 29 | + robot.respond /httpcat (.+)/i, (msg) -> |
| 30 | + if (codes.indexOf( msg.match[1] ) > -1) |
32 | 31 | msg.send 'http://httpcats.herokuapp.com/' + status + '.jpg'
|
33 | 32 | else
|
34 |
| - msg.send 'Sorry nothing found' |
| 33 | + msg.send 'I only recognize the following status codes: ' + codes |
35 | 34 |
|
36 | 35 |
|
37 | 36 | robot.respond /httpcat help/i, (msg) ->
|
|
0 commit comments