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