최지민

search_option7

Showing 1 changed file with 8 additions and 2 deletions
......@@ -79,13 +79,19 @@ function handleEvent(event) {
};
request.get(search_options, function(error, response, body){
if (!error && response.statusCode == 200){
// 검색 결과가 없을 경우
if(JSON.parse(body).items == []){
var result = { type : 'text', text : "검색 결과가 없습니다."};
}
else{
var link = JSON.parse(body).items[0].link;
var description = JSON.parse(body).items[0].description;
var result = { type: 'text', text:
title + " : " + description +
"\n\nlink : " + link
title + " : \n" + description +
"\n\nLink : \n" + link
};
}
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
}
......