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