3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

stagger joins

This commit is contained in:
reality 2014-08-18 23:13:55 +00:00
parent 964467464c
commit ad08b24c3e

13
run.js
View File

@ -1,7 +1,8 @@
var fs = require('fs'), var fs = require('fs'),
_ = require('underscore')._, _ = require('underscore')._,
jsbot = require('./jsbot/jsbot'), jsbot = require('./jsbot/jsbot'),
DatabaseDriver = require('./database').DatabaseDriver; DatabaseDriver = require('./database').DatabaseDriver,
async = require('async');
require('./snippets'); require('./snippets');
var DBot = function() { var DBot = function() {
@ -43,9 +44,13 @@ var DBot = function() {
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) {
var server = this.config.servers[event.server]; var server = this.config.servers[event.server];
for(var i=0;i<server.channels.length;i++) {
this.instance.join(event, server.channels[i]); async.eachSeries(server.channels, function(channel, next) {
} setTimeout(function() {
this.instance.join(event, channel);
next();
}.bind(this), 5000);
}.bind(this));
}.bind(this), server.nickserv, server.password); }.bind(this), server.nickserv, server.password);
}, this); }, this);