From bb977e94e2bff70e6e7860f24536083b8a02ea8e Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 10 Jan 2013 17:44:01 +0000 Subject: [PATCH] dent module [#113] --- modules/dent/config.json | 4 ++++ modules/dent/dent.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 modules/dent/config.json create mode 100644 modules/dent/dent.js diff --git a/modules/dent/config.json b/modules/dent/config.json new file mode 100644 index 0000000..cb55dd8 --- /dev/null +++ b/modules/dent/config.json @@ -0,0 +1,4 @@ +{ + "username": "youruserhere", + "password": "yourpasswordhere" +} diff --git a/modules/dent/dent.js b/modules/dent/dent.js new file mode 100644 index 0000000..5ac7a5e --- /dev/null +++ b/modules/dent/dent.js @@ -0,0 +1,31 @@ +var request = require('request'); + +var dent = function(dbot) { + var username = dbot.config.dent.username; + var password = dbot.config.dent.password; + var commands = { + '~dent': function(event) { + var auth = "Basic " + + new Buffer(username + ":" + password).toString("base64"); + request.post({ + 'url': 'http://identi.ca/api/statuses/update.json?status=' + + event.input[1], + 'headers': { + 'Authorization': auth + } + }, + function(error, response, body) { + event.reply('Status posted (probably).'); + }); + } + }; + commands['~dent'].regex = [/^~dent (.+)$/, 2]; + + return { + 'commands': commands + }; +}; + +exports.fetch = function(dbot) { + return dent(dbot); +};