은승우

Update app.js

Showing 1 changed file with 4 additions and 3 deletions
...@@ -55,14 +55,13 @@ const client = new line.Client(config); ...@@ -55,14 +55,13 @@ const client = new line.Client(config);
55 // about the middleware, please refer to doc 55 // about the middleware, please refer to doc
56 app.post('/webhook', line.middleware(config), (req, res) => { 56 app.post('/webhook', line.middleware(config), (req, res) => {
57 console.log(res.statusCode); 57 console.log(res.statusCode);
58 - console.log("webhook");
59 Promise 58 Promise
60 .all(req.body.events.map(handleEvent)) 59 .all(req.body.events.map(handleEvent))
61 .then((result) => res.json(result)) 60 .then((result) => res.json(result))
62 }); 61 });
63 // event handler 62 // event handler
64 function handleEvent(event) { 63 function handleEvent(event) {
65 - console.log("handleevent"); 64 + console.log(event.message)
66 if (event.type !== 'message' || event.message.type !== 'text') { 65 if (event.type !== 'message' || event.message.type !== 'text') {
67 // ignore non-text-message event 66 // ignore non-text-message event
68 return Promise.resolve(null); 67 return Promise.resolve(null);
...@@ -74,7 +73,6 @@ function handleEvent(event) { ...@@ -74,7 +73,6 @@ function handleEvent(event) {
74 form : {'query': event.message.text}, 73 form : {'query': event.message.text},
75 headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret} 74 headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
76 }; 75 };
77 - console.log("1");
78 //papago 언어 감지 76 //papago 언어 감지
79 request.post(detect_options,function(error,response,body){ 77 request.post(detect_options,function(error,response,body){
80 console.log(response.statusCode); 78 console.log(response.statusCode);
...@@ -122,6 +120,9 @@ function handleEvent(event) { ...@@ -122,6 +120,9 @@ function handleEvent(event) {
122 } 120 }
123 121
124 } 122 }
123 + else{
124 + console.log("status code is not 200");
125 + }
125 126
126 }); 127 });
127 128
......