Showing
1 changed file
with
3 additions
and
14 deletions
... | @@ -13,22 +13,11 @@ const sslport = 23023; | ... | @@ -13,22 +13,11 @@ const sslport = 23023; |
13 | const bodyParser = require('body-parser'); | 13 | const bodyParser = require('body-parser'); |
14 | var app = express(); | 14 | var app = express(); |
15 | app.use(bodyParser.json()); | 15 | app.use(bodyParser.json()); |
16 | -app.post('/hook', function (req, res) { | ||
17 | 16 | ||
18 | - var eventObj = req.body.events[0]; | 17 | +var cmd; |
19 | - var source = eventObj.source; | 18 | +app.post('/hook', function (req, res) { |
20 | var message = eventObj.message; | 19 | var message = eventObj.message; |
21 | - | 20 | + cmd = message.text; |
22 | - // request log | ||
23 | - console.log('======================', new Date() ,'======================'); | ||
24 | - console.log('[request]', req.body); | ||
25 | - console.log('[request source] ', eventObj.source); | ||
26 | - console.log('[request message]', eventObj.message); | ||
27 | - | ||
28 | - var cmd = message.text; | ||
29 | - console.log('[command]', cmd); | ||
30 | - | ||
31 | - res.sendStatus(200); | ||
32 | }); | 21 | }); |
33 | 22 | ||
34 | app.post('/hook', function (req, res) { | 23 | app.post('/hook', function (req, res) { | ... | ... |
-
Please register or login to post a comment