stagger pend notifies

This commit is contained in:
reality 2013-08-03 01:53:36 +00:00
parent 9a99d5eb47
commit 450ffce0e2

View File

@ -50,10 +50,21 @@ var report = function(dbot) {
this.listener = function(event) { this.listener = function(event) {
if(_.has(this.pending, event.rUser.id)) { if(_.has(this.pending, event.rUser.id)) {
_.each(this.pending[event.rUser.id], function(message) { var i=0,
dbot.say(event.server, event.rUser.currentNick, message); pending = this.pending[event.rUser.id];
});
var notifyUser = function(pending) {
if(i >= msg.length) {
delete this.pending[event.rUser.id]; delete this.pending[event.rUser.id];
return;
}
dbot.say(event.server, pending[i], message);
setTimeout(function() {
i++; notifyUser(pending);
}, 1000);
}.bind(this);
notifyUser(pending);
} }
}.bind(this); }.bind(this);
this.on = 'JOIN'; this.on = 'JOIN';