Showing
1 changed file
with
8 additions
and
2 deletions
... | @@ -79,13 +79,19 @@ function handleEvent(event) { | ... | @@ -79,13 +79,19 @@ function handleEvent(event) { |
79 | }; | 79 | }; |
80 | request.get(search_options, function(error, response, body){ | 80 | request.get(search_options, function(error, response, body){ |
81 | if (!error && response.statusCode == 200){ | 81 | if (!error && response.statusCode == 200){ |
82 | + // 검색 결과가 없을 경우 | ||
83 | + if(JSON.parse(body).items == []){ | ||
84 | + var result = { type : 'text', text : "검색 결과가 없습니다."}; | ||
85 | + } | ||
86 | + else{ | ||
82 | var link = JSON.parse(body).items[0].link; | 87 | var link = JSON.parse(body).items[0].link; |
83 | var description = JSON.parse(body).items[0].description; | 88 | var description = JSON.parse(body).items[0].description; |
84 | 89 | ||
85 | var result = { type: 'text', text: | 90 | var result = { type: 'text', text: |
86 | - title + " : " + description + | 91 | + title + " : \n" + description + |
87 | - "\n\nlink : " + link | 92 | + "\n\nLink : \n" + link |
88 | }; | 93 | }; |
94 | + } | ||
89 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); | 95 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); |
90 | } | 96 | } |
91 | 97 | ... | ... |
-
Please register or login to post a comment