3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00
This commit is contained in:
reality 2016-04-11 18:15:10 +00:00
parent bab36d5af3
commit a5657a5a36

View File

@ -7,6 +7,10 @@ var dnsm = require('dns'),
http = require('http');
var dns = function(dbot) {
if(!_.has(dbot.db, 'ip')) {
dbot.db.ip = {};
}
var ips = dbot.db.ip;
var commands = {
'~lookup': function(event) {
domain = event.params[1];
@ -32,6 +36,10 @@ var dns = function(dbot) {
'~geoip': function(event) {
var ip = event.params[1];
if(_.has(ips, ip)) {
body = ips[ip];
event.reply(ip + ' is located in '+ body.city + ', ' + body.country + '. Hostname: ' + body.hostname + '. ISP: ' + body.org);
} else {
request.get('http://ipinfo.io/'+ip, {
'json': true
}, function(err, res, body) {
@ -40,7 +48,9 @@ var dns = function(dbot) {
} else {
event.reply('No info about ' + ip);
}
ips[ip] = body;
});
}
},
'~dnsbl': function(event) {