은승우

Update app.js

Showing 1 changed file with 4 additions and 6 deletions
......@@ -81,7 +81,7 @@ async function handleEvent(event) {
return Promise.resolve(null);
}
else if (event.type == 'message'&& event.message.type == 'image') {
return new Promise((resolve,reject)=>{
return new Promise(async(resolve,reject)=>{
console.log("!");
var cheerio = require('cheerio');
......@@ -102,9 +102,7 @@ async function handleEvent(event) {
},
body: event.message.image
};
}).resolve((options)=>{
request.post(options, function (error, response, body) {
await request.post(options, function (error, response, body) {
var data=JSON.stringify(body);
var text='';
console.log(data);
......@@ -117,7 +115,7 @@ async function handleEvent(event) {
text="나의모든날들";
console.log(text);
var url="https://www.genie.co.kr/search/searchLyrics?query="+ encodeURI(text);
request(url, function(error, response, html){
request(url, function(error, response, html){
var $ = cheerio.load(html);
const $bodyList= $('#body-content > div.search_lyrics > div.music-list-wrap.type-lyrics > table > tbody > tr');
......@@ -139,7 +137,7 @@ async function handleEvent(event) {
}
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
});
})
});
})
}
else if(event.type == 'message' && event.message.type == 'text')
......