3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00
This commit is contained in:
reality 2015-02-15 18:26:25 +00:00
parent e5ac647de4
commit 5aeeb77065

View File

@ -2,7 +2,8 @@
* Module Name: DNS * Module Name: DNS
* Description: Performs and reports on basic DNS functions. * Description: Performs and reports on basic DNS functions.
*/ */
var dnsmod = require('dns'); var dnsmod = require('dns'),
request = require('request');
var dns = function(dbot) { var dns = function(dbot) {
var commands = { var commands = {
@ -26,6 +27,19 @@ var dns = function(dbot) {
event.reply(dbot.t("rdns",{"domain": domain, "ip": ip})); event.reply(dbot.t("rdns",{"domain": domain, "ip": ip}));
} }
}); });
},
'~geoip': function(event) {
var ip = event.params[1];
request.get('http://www.telize.com/geoip/'+ip, {
'json': true
}, function(err, response, body) {
if(!err && body && !_.has(body, 'code')) {
event.reply(ip + ' is located in '+ body.postal_code + ', ' + body.city + ', ' + body.country + ' and is hosted by ' + body.isp);
} else {
event.reply('No info about ' + ip);
}
});
} }
}; };
this.commands = commands; this.commands = commands;