mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
Do the [#133]
This commit is contained in:
parent
dff5825bfe
commit
ba2ab323e3
@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user