forked from GitHub/dbot
Update modules/link/link.js
Tab fix three: Revenge of the tabs
This commit is contained in:
parent
5f0bcd7710
commit
c3e569be41
@ -61,21 +61,21 @@ var link = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t("no-hits"));
|
event.reply(dbot.t("no-hits"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'~ud': function(event) {
|
'~ud': function(event) {
|
||||||
var query = event.input[1];
|
var query = event.input[1];
|
||||||
var reqUrl = 'http://api.urbandictionary.com/v0/define?term=' + encodeURI(query);
|
var reqUrl = 'http://api.urbandictionary.com/v0/define?term=' + encodeURI(query);
|
||||||
request(reqUrl, function(error, response, body) {
|
request(reqUrl, function(error, response, body) {
|
||||||
try {
|
try {
|
||||||
var result = JSON.parse(body);
|
var result = JSON.parse(body);
|
||||||
if(_.has(result, 'result_type') && result.result_type != 'no_results') {
|
if(_.has(result, 'result_type') && result.result_type != 'no_results') {
|
||||||
event.reply(query + ': ' + result.list[0].definition.split('\n')[0]);
|
event.reply(query + ': ' + result.list[0].definition.split('\n')[0]);
|
||||||
} else {
|
} else {
|
||||||
event.reply(event.user + ': No definition found.');
|
event.reply(event.user + ': No definition found.');
|
||||||
}
|
}
|
||||||
} catch(err) { }
|
} catch(err) { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user