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

that should do it

This commit is contained in:
reality 2013-10-24 12:33:50 +00:00
parent 8e791ed581
commit a1826e5c95

View File

@ -26,15 +26,15 @@ var lastfm = function(dbot) {
'json': true 'json': true
}, function(err, res, body) { }, function(err, res, body) {
if(_.has(body, 'error') && body.error == 6) { if(_.has(body, 'error') && body.error == 6) {
callback('no_user', null); callback('no_user', user, null);
} else if(_.has(body, 'recenttracks') && !_.isUndefined(body.recenttracks.track[0])) { } else if(_.has(body, 'recenttracks') && !_.isUndefined(body.recenttracks.track[0])) {
callback(null, body.recenttracks.track[0]); callback(null, user, body.recenttracks.track[0]);
} else { } else {
callback('no_listen', null); callback('no_listen', user, null);
} }
}); });
} else { } else {
callback('no_profile', null); callback('no_profile', user, null);
} }
}.bind(this)); }.bind(this));
@ -43,7 +43,7 @@ var lastfm = function(dbot) {
this.commands = { this.commands = {
'~listening': function(event) { '~listening': function(event) {
var outputListening = function(err, track) { var outputListening = function(err, user, track) {
if(!err) { if(!err) {
var term = track.name + ' ' + track.artist['#text'], var term = track.name + ' ' + track.artist['#text'],
output = ''; output = '';
@ -90,7 +90,6 @@ var lastfm = function(dbot) {
} }
}.bind(this)); }.bind(this));
} else { } else {
user = event.rUser;
this.api.getListening(event.rUser, outputListening); this.api.getListening(event.rUser, outputListening);
} }
} }