content.js 5.87 KB
var webcrawl = require('./crawling/Reol');
var async = require('async');

function jpSinger(msg, send){
    var discography;
    var task = [
        function(callback){
            webcrawl.crawl_Reol('https://namu.wiki/w/%EB%A0%88%EC%98%A4%EB%A3%A8/%EC%9D%8C%EB%B0%98#toc').then(function(Result){
                callback(null,Result)}).catch(function(err){});
        },
        function(discography, callback){
            console.log(discography);

            switch(msg){
                case 'Reol' :
                    send = {
                        'message' : {
                            'text' : '이름 : Reol(れをる) \n성별 : 여성 \n생년월일 : 1993년 11월 9일 \n혈액형 : AB형',
                            'photo' : {
                                    'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
                                    'width' : 1000,
                                    'height' : 667
                            },
                            'message_button' : {
                                'label' : '공식 홈페이지',
                                'url' : "https://www.reol.jp/"
                            }
                        },
                        keyboard : {
                            'type' : 'buttons',
                            'buttons' : ['Reol-Discography']
                        }
                    };
                    break;
                case 'Reol-Discography' :
                    console.log(discography);
                    send = {
                        'message': {
                            'text': '앨범 목록입니다.'
                        },
                        keyboard: {
                            'type': 'buttons',
                            'buttons': ['a']
                        }
                    }
                    break;
                case '米津玄師' :
                    send = {
                        'message' : {
                            'text' : '이름 : 米津玄師(Yonezu Kenshi) \n 성별 : 남성 \n생년월일 : 1991년 3월 10일 \n혈액형 : O형',
                            'photo' : {
                                'url' : 'http://reissuerecords.net/rr/wp-content/uploads/flamingo_photo2.jpg',
                                'width' : 1000,
                                'height' : 667
                            },
                            'message_button' : {
                                'label' : '공식 홈페이지',
                                'url' : "http://reissuerecords.net/"
                            }
                        },
                        keyboard : {
                            'type' : 'buttons',
                            'buttons' : ['米津玄師-Discography']
                        }
                    };
                    break;
                case '米津玄師-Discography' :
                    send = {
                        'message' : {
                            'text' : 'Album List'
                        },                
                        keyboard : {
                            'type' : 'buttons',
                            'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
                        }
        
                    };
                    break;
                default:
                    break;
            }    
            callback(null,send);
        }
    ];
    async.waterfall(task, function(err, result){
        console.log(result, send);
    });
    
    return send;
}


function krSinger(msg){
    var send = {};
    switch(msg){
        case '볼빨간사춘기' :
            send = {
                'message' : {
                    'text' : 'Reol',
                    'photo' : {
                            'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
                            'width' : 1000,
                            'height' : 667
                    },
                    'message_button' : {
                        'label' : '공식 홈페이지',
                        'url' : "https://www.reol.jp/"
                    },
                },
                keyboard : {
                    'type' : 'buttons',
                    'buttons' : ['Reol-Discography', 'Reol-Profile']
                }
            };
            break;
        case 'Reol-Discography' :
            send = {
                'message' : {
                    'text' : 'Album List.'
                },                
                keyboard : {
                    'type' : 'buttons',
                    'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
                }

            };
            break;
        case '米津玄師' :
            send = {
                'message' : {
                    'text' : '米津玄師',
                    'photo' : {
                        'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
                        'width' : 1000,
                        'height' : 667
                    },
                    'message_button' : {
                    'label' : '공식 홈페이지',
                    'url' : "https://www.reol.jp/"
                    }
                },
                keyboard : {
                    'type' : 'buttons',
                    'buttons' : ['Reol-Discography','Reol-Profile']
                }
            };
            break;
        default:
            send = {
                'message' : {
                    'text' : '등록되지 않은 가수입니다.'
                },
                keyboard : {
                    'type' : 'buttons',
                    'buttons' : ['한국', '일본']
                }
            }
            break;
    }

    return send;
} 

exports.jpSinger = jpSinger;
exports.krSinger = krSinger;