From 3cdf3fd4176dddd42aaa2c3717111f845d3fc5f6 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Wed, 6 Mar 2013 13:10:54 +0000 Subject: [PATCH] add string functionality --- modules/finger/finger.js | 5 +++-- modules/finger/strings.json | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 modules/finger/strings.json diff --git a/modules/finger/finger.js b/modules/finger/finger.js index 84256e6..1334af6 100644 --- a/modules/finger/finger.js +++ b/modules/finger/finger.js @@ -11,11 +11,12 @@ var finger = function(dbot) { '~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(0,ret); - event.reply(stdout); + stdout = stdout.substring(6,ret); + event.reply(dbot.t("name",{user: username, name: stdout})); }); } }; diff --git a/modules/finger/strings.json b/modules/finger/strings.json new file mode 100644 index 0000000..5b79835 --- /dev/null +++ b/modules/finger/strings.json @@ -0,0 +1,5 @@ +{ + "name": { + "en": "{user} is {name}." + } +}