3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00

fix config pointers in admin and imgur [#489]

This commit is contained in:
reality 2013-06-05 20:13:40 +00:00
parent 5879baeff5
commit eafc2dbee1
2 changed files with 17 additions and 4 deletions

View File

@ -22,6 +22,19 @@ var admin = function(dbot) {
}
callback(configPath);
},
'setConfig': function(configKey, newOption, callback) {
var configPath = dbot.config;
configKey = configKey.split('.');
for(var i=0;i<configKey.length-1;i++) {
if(_.has(configPath, configKey[i])) {
configPath = configPath[configKey[i]];
} else {
return;
}
}
}
};
};

View File

@ -84,7 +84,7 @@ var imgur = function(dbot) {
var hash = crypto.createHash('md5').update(body).digest("hex");
if(_.has(dbot.modules, 'quotes')){
// autoadd: {"abcdef": "facebookman"}
if(_.has(dbot.config.imgur.autoadd,hash)){
if(_.has(dbot.config.modules.imgur.autoadd,hash)){
var category = dbot.config.imgur.autoadd[hash];
if (_.contains(category, testUrl)){
// there's probably less than 62^5 chance of this happening
@ -112,7 +112,7 @@ var imgur = function(dbot) {
'url': 'https://api.imgur.com/3/image/' + slug + '.json',
'json': true,
'headers': {
'Authorization': 'Client-ID ' + dbot.config.imgur.apikey
'Authorization': 'Client-ID ' + this.config.apikey
}
}, function(err, response, body) {
dbot.db.imgur.totalApiRequests += 1;
@ -125,7 +125,7 @@ var imgur = function(dbot) {
'url': 'https://api.imgur.com/3/album/' + slug + '.json',
'json': true,
'headers': {
'Authorization': 'Client-ID ' + dbot.config.imgur.apikey
'Authorization': 'Client-ID ' + this.config.apikey
}
}, function(err, response, body) {
this.db.totalApiRequests += 1;
@ -138,7 +138,7 @@ var imgur = function(dbot) {
'url': 'https://api.imgur.com/3/gallery/' + slug + '.json',
'json': true,
'headers': {
'Authorization': 'Client-ID ' + dbot.config.imgur.apikey
'Authorization': 'Client-ID ' + this.config.apikey
}
}, function(err, response, body) {
this.db.totalApiRequests += 1;