translate module

This commit is contained in:
reality 2016-03-03 16:02:10 +00:00
parent 266f6b58f4
commit fd1a76d3bc

View File

@ -44,6 +44,9 @@ var translate = function(dbot) {
for(var i=0;i<results.length && i < 3;i++) { for(var i=0;i<results.length && i < 3;i++) {
translation = results[i]; translation = results[i];
if(!_.has(translation.phrase, 'text')) {
continue;
}
aString = (i+1) + '. ' + translation.phrase.text; aString = (i+1) + '. ' + translation.phrase.text;
if(_.has(translation, 'meanings') && translation.meanings.length > 0) { if(_.has(translation, 'meanings') && translation.meanings.length > 0) {
aString += ' (' + _.unique(_.pluck(translation.meanings, 'text')).join(', ') + ')'; aString += ' (' + _.unique(_.pluck(translation.meanings, 'text')).join(', ') + ')';