This repository was archived by the owner on Jun 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ module.exports = (robot) ->
20
20
mtaMe msg
21
21
22
22
mtaMe = (msg ) ->
23
- msg .http (' http://mta.info/status/serviceStatus.txt' )
23
+ msg .http (' http://web. mta.info/status/serviceStatus.txt' )
24
24
.get () (err , res , body ) ->
25
25
if err
26
26
throw err
@@ -30,19 +30,21 @@ mtaMe = (msg) ->
30
30
throw err
31
31
re = new RegExp (msg .match [1 ], ' gi' )
32
32
if msg .match [1 ].length is 1 or msg .match [1 ].toUpperCase () is ' SIR'
33
- for k in res .service .subway .line
34
- str = k .name
35
- if str .match (re)
36
- switch k .status
37
- when " GOOD SERVICE"
38
- msg .send " the #{ str} train is ok!"
39
- when " PLANNED WORK"
40
- msg .send " heads up, the #{ str} train has planned work (updated #{ k .Time } )"
41
- when " SERVICE CHANGE"
42
- msg .send " the #{ str} train has service changes (updated #{ k .Time } )"
43
- when " DELAYS"
44
- msg .send " the #{ str} train is delayed (updated #{ k .Time } )"
45
- else
46
- msg .send " the #{ str} train status is #{ k .status } "
33
+ for j in res .service .subway
34
+ for k in j .line
35
+ if k .name .length > 0
36
+ str = k .name [0 ]
37
+ if str .match (re)
38
+ switch k .status
39
+ when " GOOD SERVICE"
40
+ msg .send " the #{ str} train is ok!"
41
+ when " PLANNED WORK"
42
+ msg .send " heads up, the #{ str} train has planned work (updated #{ k .Time } )"
43
+ when " SERVICE CHANGE"
44
+ msg .send " the #{ str} train has service changes (updated #{ k .Time } )"
45
+ when " DELAYS"
46
+ msg .send " the #{ str} train is delayed (updated #{ k .Time } )"
47
+ else
48
+ msg .send " the #{ str} train status is #{ k .status } "
47
49
else
48
50
msg .send " that's not a valid subway line!"
You can’t perform that action at this time.
0 commit comments