3
0
mirror of https://github.com/reality/dbot.git synced 2025-02-20 07:20:59 +01:00
This commit is contained in:
reality 2013-01-14 13:10:16 +00:00
parent dff5825bfe
commit ba2ab323e3
2 changed files with 26 additions and 9 deletions

View File

@ -1,28 +1,40 @@
var request = require('request'); var request = require('request');
_ = require('underscore')._;
var dent = function(dbot) { var dent = function(dbot) {
var commands = { var api = {
'~dent': function(event) { 'post': function(content) {
var username = dbot.config.dent.username; var username = dbot.config.dent.username,
var password = dbot.config.dent.password; password = dbot.config.dent.password,
var auth = "Basic " + info,
auth = "Basic " +
new Buffer(username + ":" + password).toString("base64"); new Buffer(username + ":" + password).toString("base64");
request.post({ request.post({
'url': 'http://identi.ca/api/statuses/update.json?status=' + 'url': 'http://identi.ca/api/statuses/update.json?status=' +
event.input[1], content,
'headers': { 'headers': {
'Authorization': auth 'Authorization': auth
} }
}, },
function(error, response, body) { function(error, response, body) {
event.reply('Status posted (probably).'); console.log(body);
}); }.bind(this));
}
};
var commands = {
'~dent': function(event) {
api.post(event.input[1]);
event.reply('Dent posted (probably).');
} }
}; };
commands['~dent'].regex = [/^~dent (.+)$/, 2]; commands['~dent'].regex = [/^~dent (.+)$/, 2];
return { return {
'commands': commands 'name': 'dent',
'commands': commands,
'api': api
}; };
}; };

View File

@ -260,6 +260,11 @@ var quotes = function(dbot) {
'category': key, 'category': key,
'count': quotes[key].length 'count': quotes[key].length
})); }));
// TODO hook
if(_.has(dbot.api, 'dent')) {
dbot.api.dent.post(key + ': ' + text);
}
} }
}, },