mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 20:22:39 +01:00
commit
7bda956dbb
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``
|
34
modules/finger/finger.js
Normal file
34
modules/finger/finger.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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){
|
||||||
|
stdout = stdout.replace(/(\r\n|\n|\r)/gm,"");
|
||||||
|
name = stdout.search("Name:");
|
||||||
|
stdout = stdout.substring(name);
|
||||||
|
ret = stdout.search("Dir");
|
||||||
|
stdout = stdout.substring(6,ret);
|
||||||
|
if (stdout == "Welcom") {
|
||||||
|
event.reply(dbot.t("nonexistent",{user: username}));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t("name",{user: username, name: stdout}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.commands = commands;
|
||||||
|
|
||||||
|
this.on = 'PRIVMSG';
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.fetch = function(dbot) {
|
||||||
|
return new finger(dbot);
|
||||||
|
};
|
8
modules/finger/strings.json
Normal file
8
modules/finger/strings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"en": "{user} is {name}."
|
||||||
|
},
|
||||||
|
"nonexistent": {
|
||||||
|
"en": "{user} not found."
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user