3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

spotify link in listening out

This commit is contained in:
reality 2016-12-05 19:48:08 +00:00
parent 238c112986
commit 7964bb9e88
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{
"dependencies": [ "profile" ],
"dependencies": [ "profile", "youtube", "spotify" ],
"api_key": "blah",
"outputPrefix": "\u000315,5last.fm\u000f"
}

View File

@ -220,6 +220,7 @@ var lastfm = function(dbot) {
'artist': track.artist.name
});
var term = track.name + ' ' + track.artist.name;
dbot.api.youtube.search(term, function(body) {
if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) {
var link = body.items[0].id.videoId
@ -227,8 +228,15 @@ var lastfm = function(dbot) {
output += ' - http://youtu.be/' + link;
}
}
dbot.api.spotify.spotifySearch(term, function(body, t) {
if(body) {
output += ' - ' + t;
}
event.reply(output);
});
});
} else {
event.reply('something broke');
}