Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from ryayak1460/master
Browse files Browse the repository at this point in the history
Included a help route and a default route.
  • Loading branch information
ryayak1460 committed Nov 11, 2014
2 parents e90e24f + c89e231 commit 54c2184
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@
var text = req.body.Body;
logRequestDebuggingValues(req);

// Check for an address.
(hasAddress(text) ?
// Asking for help.
(/help/i.test(text) ?
getResponse('Hi, thanks for texting your HRT bus! Please text an '
+ 'address or a stop number to find the next time your bus will'
+ ' come your way.') :
// Check for an address.
hasAddress(text) ?
getStop(text).then(getTimes).then(getResponse) :
// Checks for a bus stop number, like http://hrtb.us/#stops/0263
hasStop(text) ?
getTimes(text).then(getResponse) :
// Otherwise, give a help(ful) message.
getResponse('Hi, thanks for texting your HRT bus! Please text a '
+ 'stop number to find the next time your bus will come your '
+ 'way.')).then(res.send.bind(res));
getResponse('Hi! You have texted the Text Your Bus application. I '
+ 'do not quite understand your request. Please text "help" '
+ 'for a list of possible options.')).then(res.send.bind(res));
});

/**
Expand Down

0 comments on commit 54c2184

Please sign in to comment.