Last active
May 14, 2016 07:16
-
-
Save perfectmak/147e58fe77dcc8ce4cabfd8a1d790f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
/** | |
* Processes a users message and gives relevant output | |
*/ | |
const processRequest = (message, output) => { | |
if(helloWords.indexOf(message.toLowerCase()) != -1) { | |
return output(greeting); | |
} | |
if(message.toLowerCase() === helpWord) { | |
return output(instructions); | |
} | |
ping.sys.probe(sanitizeLink(message), (result, error) => { | |
if(error) { | |
console.log('error'. error); | |
} | |
else { | |
output(formatPingResult(result)); | |
} | |
}); | |
} | |
module.exports = processRequest; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment