dbot/modules/admin/admin.js

32 lines
849 B
JavaScript
Raw Normal View History

/**
* Module Name: Admin
* Description: Set of commands which only one who is a DepressionBot
* administrator can run - as such, it has its own command execution listener.
*/
2013-01-12 18:36:59 +01:00
var fs = require('fs'),
2013-01-14 17:56:34 +01:00
_ = require('underscore')._;
var admin = function(dbot) {
this.internalAPI = {
'getCurrentConfig': function(configKey, callback) {
2013-06-04 02:06:41 +02:00
var configPath = dbot.config;
configKey = configKey.split('.');
2013-06-04 02:06:41 +02:00
for(var i=0;i<configKey.length;i++) {
if(_.has(configPath, configKey[i])) {
configPath = configPath[configKey[i]];
} else {
configPath = null;
break;
}
}
2013-06-04 02:06:41 +02:00
callback(configPath);
}
};
};
exports.fetch = function(dbot) {
2013-01-14 17:56:34 +01:00
return new admin(dbot);
};