Created
August 4, 2017 00:35
-
-
Save the-vampiire/d4416b18f5e9c088eef052ff31ce41e7 to your computer and use it in GitHub Desktop.
/update command route code
This file contains hidden or 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
| // Excerpt from controller.js focusing on the /update route that Slack sends all /update requests to | |
| router.post('/update', (req, res) => { | |
| const respond = require('./tools/respond'); | |
| const body = req.body; | |
| const arguments = body.text; | |
| if(tools.verify.slash(body.token)){ | |
| if(~arguments.indexOf(' ')){ | |
| // do stuff with argument parser | |
| }else{ | |
| if(!arguments) res.send(respond.helpResponse('help')); | |
| res.send(respond.helpResponse(arguments)); | |
| } | |
| }else{ | |
| res.end('invalid Slack token'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment