3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 11:42:36 +01:00

strings for lastfm

This commit is contained in:
reality 2013-10-24 09:37:54 +00:00
parent 93b751af29
commit 1c1ba2ef02
2 changed files with 22 additions and 3 deletions

View File

@ -30,12 +30,20 @@ var lastfm = function(dbot) {
} else if(_.has(body, 'recenttracks') && !_.isUndefined(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(dbot.t('now_listening', {
'user': event.user,
'track': track.name,
'artist': track.artist['#text']
}));
} else {
event.reply(event.user + ' last listened to ' + track.name + ' by ' + track.artist['#text']);
event.reply(dbot.t('last_listened', {
'user': event.user,
'track': track.name,
'artist': track.artist['#text']
}));
}
} else {
event.reply(event.user + ' isn\'t listening to anything right now :\'(');
event.reply(dbot.t('no_listen', { 'user': event.user }));
}
});
} else {

View File

@ -0,0 +1,11 @@
{
"now_listening": {
"en": "{user} is listening to {track} by {artist}"
},
"last_listened": {
"en": "{user} last listened to {track} by {artist}"
},
"no_listen": {
"en": "{user} doesn't seem to have listened to anything recently :'("
}
}