권은령

fixing error...

Showing 1 changed file with 6 additions and 6 deletions
......@@ -121,9 +121,6 @@ function handleEvent(event)
else if(event.message.text.substring(0, 5)=='순위 보기')
{
// music list 출력
return new Promise(function(resolve, reject){
var result = { type: 'text', text:''};
var url="https://www.genie.co.kr/chart/top200";
request(url, function(error, response, html){
......@@ -131,8 +128,7 @@ function handleEvent(event)
var songList=[];
const $bodyList= $('#body-content > div.newest-list > div > table > tbody > tr');
$bodyList.each(function(i, elem)
{
$bodyList.each(function(i, elem){
if(i<20)
{
songList.push(
......@@ -147,13 +143,17 @@ function handleEvent(event)
return;
}
});
});
return new Promise(function(resolve, reject)
{
var result = { type: 'text', text:''};
for(var i=0; i<songList.length; i++)
{
result.text+=i+1 + ". "+ songList[i].singer+" - "+songList[i].song+"\n";
}
console.log(result.text);
});
client.replyMessage(event.replyToken, result).then(resolve).catch(reject);
});
}
......