3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

distinction between now playing and last playedd

This commit is contained in:
reality 2013-10-23 20:46:32 +00:00
parent 9d48917d09
commit fbf1bc1ae2

View File

@ -29,7 +29,11 @@ var lastfm = function(dbot) {
event.reply('Unknown Last.FM user.'); event.reply('Unknown Last.FM user.');
} else if(_.has(body, 'recenttracks') && !_.isUndefined(body.recenttracks.track[0])) { } else if(_.has(body, 'recenttracks') && !_.isUndefined(body.recenttracks.track[0])) {
var track = body.recenttracks.track[0]; var track = body.recenttracks.track[0];
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']); 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 { } else {
event.reply(event.user + ' isn\'t listening to anything right now :\'('); event.reply(event.user + ' isn\'t listening to anything right now :\'(');
} }