mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
fix config pointers in admin and imgur [#489]
This commit is contained in:
parent
5879baeff5
commit
eafc2dbee1
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user