From 1b67b04630ac54f33010bcbb50eb8262fbf24d89 Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 31 Oct 2014 04:27:08 +0000 Subject: [PATCH] like --- modules/words/words.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/words/words.js b/modules/words/words.js index 34e17ab..ff5e79c 100644 --- a/modules/words/words.js +++ b/modules/words/words.js @@ -16,12 +16,16 @@ var words = function(dbot) { '~like': function(event) { var query = event.params[1]; this.wn.word(query, {}, function(err, word) { - if(!err && word[0]) { + if(!err && word) { word.related({ 'limit': 10 }, function(err, related) { - event.reply('Words related to ' + query + ': ' + - related[0].words.join(', ') + '.'); + if(related[0]) { + event.reply('Words related to ' + query + ': ' + + related[0].words.join(', ') + '.'); + } else { + event.reply('No similar words found.'); + } }); } else { event.reply('Unknown word.');