Showing
1 changed file
with
13 additions
and
7 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 | - var link = JSON.parse(body).items[0].link; | 82 | + // 검색 결과가 없을 경우 |
83 | - var description = JSON.parse(body).items[0].description; | 83 | + if(JSON.parse(body).items == []){ |
84 | - | 84 | + var result = { type : 'text', text : "검색 결과가 없습니다."}; |
85 | - var result = { type: 'text', text: | 85 | + } |
86 | - title + " : " + description + | 86 | + else{ |
87 | - "\n\nlink : " + link | 87 | + var link = JSON.parse(body).items[0].link; |
88 | - }; | 88 | + var description = JSON.parse(body).items[0].description; |
89 | + | ||
90 | + var result = { type: 'text', text: | ||
91 | + title + " : \n" + description + | ||
92 | + "\n\nLink : \n" + link | ||
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