|
20 | 20 | # Author:
|
21 | 21 | # @commadelimited
|
22 | 22 |
|
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'] |
| 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] |
27 | 27 |
|
28 | 28 | module.exports = (robot) ->
|
29 | 29 | robot.respond /httpcat (.+)/i, (msg) ->
|
30 |
| - if (codes.indexOf( msg.match[1] ) > -1) |
| 30 | + status = parseInt(msg.match[1], 10) |
| 31 | + if (codes.indexOf( status ) > -1) |
31 | 32 | msg.send 'http://httpcats.herokuapp.com/' + status + '.jpg'
|
32 | 33 | else
|
33 | 34 | msg.send 'I only recognize the following status codes: ' + codes
|
|
0 commit comments