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

i think this do it

This commit is contained in:
reality 2013-10-13 04:17:17 +00:00
parent 9b036039c5
commit e9605b60d3

View File

@ -29,8 +29,7 @@ var youtube = function(dbot) {
v['yt$statistics'] = { 'viewCount': 0 };
}
var link = v.link[0].href.match(this.LinkRegex)[2];
return dbot.t('yt_video', {
var res = dbot.t('yt_video', {
'title': v.title['$t'],
'plays': v['yt$statistics'].viewCount.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"),
'author': v.author[0].name['$t'],
@ -38,7 +37,14 @@ var youtube = function(dbot) {
'dislikes': v['yt$rating'].numDislikes,
'minutes': minutes,
'seconds': seconds
}) + ' - ' + 'http://youtu.be/' + link;
});
var link = v.link[0].href.match(this.LinkRegex)
if(!_.isUndefined(link)) {
res += ' - ' + link[2];
}
return res;
}.bind(this)
};