forked from GitHub/dbot
reports
This commit is contained in:
parent
439fcf567c
commit
5b067094de
@ -87,14 +87,19 @@ var commands = function(dbot) {
|
||||
var ban = null,
|
||||
quiet = 0,
|
||||
warn = 0,
|
||||
report = 0,
|
||||
quiets = [],
|
||||
warns = [];
|
||||
warns = [],
|
||||
reports = [];
|
||||
|
||||
// i'll fix it later
|
||||
dbot.modules.report.db.search('notifies', {
|
||||
'server': event.server
|
||||
}, function(notify) {
|
||||
if(notify.message.match('banned ' + user.primaryNick) || notify.message.match('issued a warning to ' + user.primaryNick) || notify.message.match('has quieted ' + user.primaryNick)) {
|
||||
if(notify.message.match('banned ' + user.primaryNick) ||
|
||||
notify.message.match('issued a warning to ' + user.primaryNick) ||
|
||||
notify.message.match('has quieted ' + user.primaryNick) ||
|
||||
notify.message.match('has reported ' + user.primaryNick)) {
|
||||
if(notify.type == 'ban') {
|
||||
ban = notify.time;
|
||||
} else if(notify.type == 'quiet') {
|
||||
@ -103,19 +108,26 @@ var commands = function(dbot) {
|
||||
} else if(notify.type == 'warn') {
|
||||
warn++;
|
||||
warns.push(notify.message);
|
||||
} else if(notify.type == 'report') {
|
||||
report++;
|
||||
reports.push(notify.message);
|
||||
}
|
||||
}
|
||||
}, function() {
|
||||
if(ban) {
|
||||
event.reply(user.primaryNick + ' was banned on ' + new Date(ban).toUTCString());
|
||||
} else if(quiet != 0 || warn != 0) {
|
||||
event.reply(user.primaryNick + ' has been warned ' + warn + ' times, and quieted ' + quiet + ' times.');
|
||||
if(quiet != 0 || warn != 0) {
|
||||
event.reply(user.primaryNick + ' has been warned ' + warn + ' times, quieted ' + quiet + ' times, and reported ' + report + ' times.');
|
||||
_.each(quiets, function(message) {
|
||||
event.reply(message);
|
||||
});
|
||||
_.each(warns, function(message) {
|
||||
event.reply(message);
|
||||
});
|
||||
_.each(reports, function(message) {
|
||||
event.reply(message);
|
||||
});
|
||||
if(ban) {
|
||||
event.reply(user.primaryNick + ' was banned on ' + new Date(ban).toUTCString());
|
||||
}
|
||||
} else {
|
||||
event.reply(user.primaryNick + ' has no record.');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user