3
0
mirror of https://github.com/reality/dbot.git synced 2025-01-24 02:54:16 +01:00

well lets give this a try

This commit is contained in:
reality 2013-11-02 21:40:10 +00:00
parent fc415aa6c6
commit 2ce0e67d4b
2 changed files with 16 additions and 13 deletions

View File

@ -15,6 +15,7 @@ var DatabaseDriver = function(config) {
* Connect to or create a new DataBank * Connect to or create a new DataBank
*/ */
DatabaseDriver.prototype.createDB = function(name, driver, schema, callback) { DatabaseDriver.prototype.createDB = function(name, driver, schema, callback) {
if(!_.has(this.databanks, name)) {
var params = { 'schema': schema }; var params = { 'schema': schema };
if(driver == 'redis' && _.has(this.config, 'redisPort')) params.port = this.config.redisPort; if(driver == 'redis' && _.has(this.config, 'redisPort')) params.port = this.config.redisPort;
@ -28,6 +29,9 @@ DatabaseDriver.prototype.createDB = function(name, driver, schema, callback) {
callback(this.databanks[name]); callback(this.databanks[name]);
} }
}.bind(this)); }.bind(this));
} else {
callback(this.databanks[name]);
}
}; };
exports.DatabaseDriver = DatabaseDriver; exports.DatabaseDriver = DatabaseDriver;

3
run.js
View File

@ -165,6 +165,7 @@ DBot.prototype.reloadModules = function() {
delete require.cache[path]; delete require.cache[path];
require('./snippets'); require('./snippets');
// Clear JSBot listeners and hooks
this.instance.removeListeners(); this.instance.removeListeners();
this.instance.clearHooks(); this.instance.clearHooks();
@ -217,7 +218,6 @@ DBot.prototype.reloadModules = function() {
} }
} }
process.nextTick(function() {
_.each(moduleNames, function(name) { _.each(moduleNames, function(name) {
if(this.status[name] === true) { if(this.status[name] === true) {
try { try {
@ -304,7 +304,6 @@ DBot.prototype.reloadModules = function() {
this.modules[module.name] = module; this.modules[module.name] = module;
} }
}.bind(this)); }.bind(this));
}.bind(this));
process.nextTick(function() { process.nextTick(function() {
if(_.has(this.modules, 'web')) this.modules.web.reloadPages(); if(_.has(this.modules, 'web')) this.modules.web.reloadPages();