3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 12:59:34 +01:00
dbot/modules/finger/finger.js

30 lines
821 B
JavaScript
Raw Normal View History

/**
* Module Name: Finger
* Description: Returns the name of users via the Finger protocol
*/
var request = require('request'),
_ = require('underscore')._,
exec = require('child_process').exec;
var finger = function(dbot) {
var commands = {
'~finger': function(event) {
var username = event.params[1];
exec("finger -s " + username + "@central.aber.ac.uk",function(error,stdout,stderr){
name = stdout.search("Name:");
stdout = stdout.substring(name);
ret = stdout.search("Dir");
stdout = stdout.substring(0,ret);
event.reply(stdout);
});
}
};
this.commands = commands;
this.on = 'PRIVMSG';
};
exports.fetch = function(dbot) {
return new finger(dbot);
};