mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 04:02:39 +01:00
Merge pull request #671 from Scritches/master
Words module api support for phrases
This commit is contained in:
commit
8182980420
@ -4,7 +4,7 @@ var Wordnik = require('wordnik'),
|
||||
var words = function(dbot) {
|
||||
this.commands = {
|
||||
'~define': function(event) {
|
||||
var query = event.params[1];
|
||||
var query = event.params.slice(1).join(" ");
|
||||
this.wn.definitions(encodeURIComponent(query), function(err, defs) {
|
||||
if(!err && defs[0]) {
|
||||
event.reply(dbot.t('def', {
|
||||
@ -18,8 +18,8 @@ var words = function(dbot) {
|
||||
},
|
||||
|
||||
'~like': function(event) {
|
||||
var query = event.params[1];
|
||||
this.wn.word(query, {}, function(err, word) {
|
||||
var query = event.params.slice(1).join(" ");
|
||||
this.wn.word(encodeURIComponent(query), {}, function(err, word) {
|
||||
if(!err && word) {
|
||||
word.related({
|
||||
'limit': 10
|
||||
@ -40,11 +40,11 @@ var words = function(dbot) {
|
||||
},
|
||||
|
||||
'~example': function(event) {
|
||||
var query = event.params[1];
|
||||
this.wn.word(query, {}, function(err, word) {
|
||||
if(!err && word) {
|
||||
word.topExample({}, function(err, example) {
|
||||
var query = event.params.slice(1).join(" ");
|
||||
|
||||
this.wn.topExample(encodeURIComponent(query), {}, function(err, example) {
|
||||
if(!err && example) {
|
||||
console.log(rep);
|
||||
var rep = new RegExp(query, 'g');
|
||||
event.reply(dbot.t('def', {
|
||||
'word': query + ' example',
|
||||
@ -54,10 +54,6 @@ var words = function(dbot) {
|
||||
event.reply(dbot.t('no_example', { 'word': query }));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
event.reply(dbot.t('no_word', { 'word': query }));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'~rw': function(event) {
|
||||
|
Loading…
Reference in New Issue
Block a user