From c89e23172187e9cba9caee46af03cd097893532f Mon Sep 17 00:00:00 2001 From: Ryan Y Date: Tue, 11 Nov 2014 08:26:23 -0500 Subject: [PATCH] Included a help route and a default route. --- app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 4be9fee..b554410 100644 --- a/app.js +++ b/app.js @@ -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)); }); /**