mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 19:52:36 +01:00
add basic, hackish finger functionality
This commit is contained in:
parent
e648068b1c
commit
ab8e297769
13
modules/finger/README.md
Normal file
13
modules/finger/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
## Finger
|
||||
|
||||
Retrieves user information from a remote server.
|
||||
|
||||
### Description
|
||||
Uses the ``finger`` command to retrieve limited information on users.
|
||||
|
||||
|
||||
### Commands
|
||||
###~finger [username]
|
||||
Returns the real name of the user specified.
|
||||
### Dependencies
|
||||
* ``npm install request``
|
29
modules/finger/finger.js
Normal file
29
modules/finger/finger.js
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user