Showing
1 changed file
with
2 additions
and
6 deletions
... | @@ -14,12 +14,6 @@ const bodyParser = require('body-parser'); | ... | @@ -14,12 +14,6 @@ const bodyParser = require('body-parser'); |
14 | var app = express(); | 14 | var app = express(); |
15 | app.use(bodyParser.json()); | 15 | app.use(bodyParser.json()); |
16 | 16 | ||
17 | -app.get('/hook', function (req, res) { | ||
18 | - var eventObj = req.body.events[0]; | ||
19 | - var message = eventObj.message; | ||
20 | - var cmd = message.text; | ||
21 | -}); | ||
22 | - | ||
23 | app.post('/hook', function (req, res) { | 17 | app.post('/hook', function (req, res) { |
24 | 18 | ||
25 | var eventObj = req.body.events[0]; | 19 | var eventObj = req.body.events[0]; |
... | @@ -32,6 +26,8 @@ app.post('/hook', function (req, res) { | ... | @@ -32,6 +26,8 @@ app.post('/hook', function (req, res) { |
32 | console.log('[request source] ', eventObj.source); | 26 | console.log('[request source] ', eventObj.source); |
33 | console.log('[request message]', eventObj.message); | 27 | console.log('[request message]', eventObj.message); |
34 | 28 | ||
29 | + var cmd = message.text; | ||
30 | + | ||
35 | if(cmd == "영어"){ | 31 | if(cmd == "영어"){ |
36 | transen(eventObj.replyToken, eventObj.message.text); | 32 | transen(eventObj.replyToken, eventObj.message.text); |
37 | } | 33 | } | ... | ... |
-
Please register or login to post a comment