This commit is contained in:
reality 2015-01-19 22:06:33 +00:00
parent 5b067094de
commit 4709a11fad

View File

@ -88,9 +88,7 @@ var commands = function(dbot) {
quiet = 0, quiet = 0,
warn = 0, warn = 0,
report = 0, report = 0,
quiets = [], items = {};
warns = [],
reports = [];
// i'll fix it later // i'll fix it later
dbot.modules.report.db.search('notifies', { dbot.modules.report.db.search('notifies', {
@ -104,27 +102,21 @@ var commands = function(dbot) {
ban = notify.time; ban = notify.time;
} else if(notify.type == 'quiet') { } else if(notify.type == 'quiet') {
quiet++; quiet++;
quiets.push(notify.message);
} else if(notify.type == 'warn') { } else if(notify.type == 'warn') {
warn++; warn++;
warns.push(notify.message);
} else if(notify.type == 'report') { } else if(notify.type == 'report') {
report++; report++;
reports.push(notify.message);
} }
items[notify.time] = notify.message;
} }
}, function() { }, function() {
if(quiet != 0 || warn != 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(quiets, function(message) {
event.reply(message); _.each(_.sort(_.keys(items)), function(time) {
}); event.reply('[' + moment(new Date(time)).format('dd/mm/YYYY') + '] ' + items[time]);
_.each(warns, function(message) {
event.reply(message);
});
_.each(reports, function(message) {
event.reply(message);
}); });
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());
} }