From 7964bb9e88a1b5292dd828486b7dd3439706e260 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 5 Dec 2016 19:48:08 +0000 Subject: [PATCH] spotify link in listening out --- modules/lastfm/config.json | 2 +- modules/lastfm/lastfm.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/lastfm/config.json b/modules/lastfm/config.json index 222be76..817c6b1 100644 --- a/modules/lastfm/config.json +++ b/modules/lastfm/config.json @@ -1,5 +1,5 @@ { - "dependencies": [ "profile" ], + "dependencies": [ "profile", "youtube", "spotify" ], "api_key": "blah", "outputPrefix": "\u000315,5last.fm\u000f" } diff --git a/modules/lastfm/lastfm.js b/modules/lastfm/lastfm.js index 7b979c8..083c9c9 100644 --- a/modules/lastfm/lastfm.js +++ b/modules/lastfm/lastfm.js @@ -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,7 +228,14 @@ var lastfm = function(dbot) { output += ' - http://youtu.be/' + link; } } - event.reply(output); + + dbot.api.spotify.spotifySearch(term, function(body, t) { + if(body) { + output += ' - ' + t; + } + + event.reply(output); + }); }); } else { event.reply('something broke');