forked from GitHub/dbot
well lets give this a try
This commit is contained in:
parent
fc415aa6c6
commit
2ce0e67d4b
26
database.js
26
database.js
@ -15,19 +15,23 @@ var DatabaseDriver = function(config) {
|
||||
* Connect to or create a new DataBank
|
||||
*/
|
||||
DatabaseDriver.prototype.createDB = function(name, driver, schema, callback) {
|
||||
var params = { 'schema': schema };
|
||||
if(!_.has(this.databanks, name)) {
|
||||
var params = { 'schema': schema };
|
||||
|
||||
if(driver == 'redis' && _.has(this.config, 'redisPort')) params.port = this.config.redisPort;
|
||||
if(driver == 'disk') params.dir = 'db';
|
||||
if(driver == 'redis' && _.has(this.config, 'redisPort')) params.port = this.config.redisPort;
|
||||
if(driver == 'disk') params.dir = 'db';
|
||||
|
||||
this.databanks[name] = Databank.get(driver, params);
|
||||
this.databanks[name].connect({}, function(err) {
|
||||
if(err) {
|
||||
console.log('Didn\'t manage to connect to the data source - ' + err);
|
||||
} else {
|
||||
callback(this.databanks[name]);
|
||||
}
|
||||
}.bind(this));
|
||||
this.databanks[name] = Databank.get(driver, params);
|
||||
this.databanks[name].connect({}, function(err) {
|
||||
if(err) {
|
||||
console.log('Didn\'t manage to connect to the data source - ' + err);
|
||||
} else {
|
||||
callback(this.databanks[name]);
|
||||
}
|
||||
}.bind(this));
|
||||
} else {
|
||||
callback(this.databanks[name]);
|
||||
}
|
||||
};
|
||||
|
||||
exports.DatabaseDriver = DatabaseDriver;
|
||||
|
3
run.js
3
run.js
@ -165,6 +165,7 @@ DBot.prototype.reloadModules = function() {
|
||||
delete require.cache[path];
|
||||
require('./snippets');
|
||||
|
||||
// Clear JSBot listeners and hooks
|
||||
this.instance.removeListeners();
|
||||
this.instance.clearHooks();
|
||||
|
||||
@ -217,7 +218,6 @@ DBot.prototype.reloadModules = function() {
|
||||
}
|
||||
}
|
||||
|
||||
process.nextTick(function() {
|
||||
_.each(moduleNames, function(name) {
|
||||
if(this.status[name] === true) {
|
||||
try {
|
||||
@ -304,7 +304,6 @@ DBot.prototype.reloadModules = function() {
|
||||
this.modules[module.name] = module;
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
process.nextTick(function() {
|
||||
if(_.has(this.modules, 'web')) this.modules.web.reloadPages();
|
||||
|
Loading…
Reference in New Issue
Block a user