Few tests and that

This commit is contained in:
reality 2013-01-12 10:38:40 +00:00
parent 400169f9ee
commit e68cf45e65

15
run.js
View File

@ -1,6 +1,7 @@
var fs = require('fs'); var fs = require('fs'),
var timers = require('./timer'); _ = require('underscore')._,
var jsbot = require('./jsbot/jsbot'); timers = require('./timer'),
jsbot = require('./jsbot/jsbot');
require('./snippets'); require('./snippets');
var DBot = function(timers) { var DBot = function(timers) {
@ -17,13 +18,13 @@ var DBot = function(timers) {
process.exit(); process.exit();
} }
} }
requiredConfigKeys.each(function(key) { _.each(requiredConfigKeys, function(key) {
if(!this.config.hasOwnProperty(key)) { if(!_.has(this.config, key)) {
console.log('Error: Please set a value for ' + key + ' in ' + console.log('Error: Please set a value for ' + key + ' in ' +
'config.json. Stopping.'); 'config.json. Stopping.');
process.exit(); process.exit();
} }
}.bind(this)); }, this);
var rawDB; var rawDB;
try { try {
@ -58,7 +59,7 @@ var DBot = function(timers) {
// Create JSBot and connect to each server // Create JSBot and connect to each server
this.instance = jsbot.createJSBot(this.config.name); this.instance = jsbot.createJSBot(this.config.name);
for(var name in this.config.servers) { for(var name in this.config.servers) {
if(this.config.servers.hasOwnProperty(name)) { if(_.has(this.config.servers, name)) {
var server = this.config.servers[name]; var server = this.config.servers[name];
this.instance.addConnection(name, server.server, server.port, this.instance.addConnection(name, server.server, server.port,
this.config.admin, function(event) { this.config.admin, function(event) {