async output next 1s delay

This commit is contained in:
reality 2015-01-19 22:28:18 +00:00
parent e5b8034e0f
commit 552b87c29e

View File

@ -1,5 +1,6 @@
var _ = require('underscore')._, var _ = require('underscore')._,
moment = require('moment'); moment = require('moment'),
asynx = require('async');
var commands = function(dbot) { var commands = function(dbot) {
var commands = { var commands = {
@ -113,11 +114,12 @@ var commands = function(dbot) {
if(quiet != 0 || warn != 0 || report != 0) { if(quiet != 0 || warn != 0 || report != 0) {
event.reply(user.primaryNick + ' has been warned ' + warn + ' times, quieted ' + quiet + ' times, and reported ' + report + ' times.'); event.reply(user.primaryNick + ' has been warned ' + warn + ' times, quieted ' + quiet + ' times, and reported ' + report + ' times.');
_.each(_.keys(items).sort(function(a, b) { async.eachSeries(_.keys(items).sort(function(a, b) {
return parseInt(new Date(a).getTime()) - parseInt(new Date(b).getTime()); return parseInt(new Date(a).getTime()) - parseInt(new Date(b).getTime());
}), function(time) { }), function(time, next) {
event.reply('[' + moment(parseInt(time)).format('DD/MM/YYYY') + '] ' + items[time]); event.reply('[' + moment(parseInt(time)).format('DD/MM/YYYY') + '] ' + items[time]);
}); setTimeout(next, 1000);
}, function(){});
if(ban) { if(ban) {
event.reply(user.primaryNick + ' was banned on ' + new Date(ban).toUTCString()); event.reply(user.primaryNick + ' was banned on ' + new Date(ban).toUTCString());