Skip to content

Instantly share code, notes, and snippets.

@perfectmak
Last active May 14, 2016 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perfectmak/147e58fe77dcc8ce4cabfd8a1d790f07 to your computer and use it in GitHub Desktop.
Save perfectmak/147e58fe77dcc8ce4cabfd8a1d790f07 to your computer and use it in GitHub Desktop.
...
/**
* 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