diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-09-27 12:04:36 +0200 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-09-27 12:04:36 +0200 |
commit | dfe3d68edaddd71b020f39ae676ac7e1ec3d7c04 (patch) | |
tree | 94cbda3ab9e25f48441181c09ff53d7aa54f60ae | |
parent | a03f63c9a7474af07e91e9770397e08e8964e6ad (diff) |
Add slack error message
-rw-r--r-- | src/server/routes/slack.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/routes/slack.js b/src/server/routes/slack.js index ac38c9a..5dc7047 100644 --- a/src/server/routes/slack.js +++ b/src/server/routes/slack.js @@ -2,9 +2,16 @@ const express = require('express') const router = express.Router() router.all('/', function (req, res, next) { + if (!/^[0-9]+$/.test(req.body.text)) { + res.json({ + "response_type": "ephemeral", + "text": "Only student id's are currently supported, more comming soon!" + }) + return + } res.json({ "response_type": "in_channel", - "text": "Here is the schedule of _18561_", + "text": `Here is the schedule of _${req.body.text}_`, "mrkdwn": true, "attachments": [ { |