From fbf1bc1ae27b1777870ff25cc3d4d1ee72070f28 Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 23 Oct 2013 20:46:32 +0000 Subject: [PATCH] distinction between now playing and last playedd --- modules/lastfm/lastfm.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/lastfm/lastfm.js b/modules/lastfm/lastfm.js index 8bd302e..2b4c99d 100644 --- a/modules/lastfm/lastfm.js +++ b/modules/lastfm/lastfm.js @@ -29,7 +29,11 @@ var lastfm = function(dbot) { event.reply('Unknown Last.FM user.'); } else if(_.has(body, 'recenttracks') && !_.isUndefined(body.recenttracks.track[0])) { var track = body.recenttracks.track[0]; - event.reply(event.user + ' is listening to ' + track.name + ' by ' + track.artist['#text']); + if(_.has(track, '@attr') && _.has(track['@attr'], 'nowplaying') && track['@attr'].nowplaying == 'true') { + event.reply(event.user + ' is listening to ' + track.name + ' by ' + track.artist['#text']); + } else { + event.reply(event.user + ' last listened to ' + track.name + ' by ' + track.artist['#text']); + } } else { event.reply(event.user + ' isn\'t listening to anything right now :\'('); }