3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +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');
_ = require('underscore')._;
var dent = function(dbot) {
var commands = {
'~dent': function(event) {
var username = dbot.config.dent.username;
var password = dbot.config.dent.password;
var auth = "Basic " +
var api = {
'post': function(content) {
var username = dbot.config.dent.username,
password = dbot.config.dent.password,
info,
auth = "Basic " +
new Buffer(username + ":" + password).toString("base64");
request.post({
'url': 'http://identi.ca/api/statuses/update.json?status=' +
event.input[1],
content,
'headers': {
'Authorization': auth
}
},
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];
return {
'commands': commands
'name': 'dent',
'commands': commands,
'api': api
};
};

View File

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