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) {
if(_.has(this.pending, event.rUser.id)) {
_.each(this.pending[event.rUser.id], function(message) {
dbot.say(event.server, event.rUser.currentNick, message);
});
delete this.pending[event.rUser.id];
var i=0,
pending = this.pending[event.rUser.id];
var notifyUser = function(pending) {
if(i >= msg.length) {
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);
this.on = 'JOIN';