mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
reports
This commit is contained in:
parent
439fcf567c
commit
5b067094de
@ -87,14 +87,19 @@ var commands = function(dbot) {
|
|||||||
var ban = null,
|
var ban = null,
|
||||||
quiet = 0,
|
quiet = 0,
|
||||||
warn = 0,
|
warn = 0,
|
||||||
|
report = 0,
|
||||||
quiets = [],
|
quiets = [],
|
||||||
warns = [];
|
warns = [],
|
||||||
|
reports = [];
|
||||||
|
|
||||||
// i'll fix it later
|
// i'll fix it later
|
||||||
dbot.modules.report.db.search('notifies', {
|
dbot.modules.report.db.search('notifies', {
|
||||||
'server': event.server
|
'server': event.server
|
||||||
}, function(notify) {
|
}, 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') {
|
if(notify.type == 'ban') {
|
||||||
ban = notify.time;
|
ban = notify.time;
|
||||||
} else if(notify.type == 'quiet') {
|
} else if(notify.type == 'quiet') {
|
||||||
@ -103,19 +108,26 @@ var commands = function(dbot) {
|
|||||||
} else if(notify.type == 'warn') {
|
} else if(notify.type == 'warn') {
|
||||||
warn++;
|
warn++;
|
||||||
warns.push(notify.message);
|
warns.push(notify.message);
|
||||||
|
} else if(notify.type == 'report') {
|
||||||
|
report++;
|
||||||
|
reports.push(notify.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
if(ban) {
|
if(quiet != 0 || warn != 0) {
|
||||||
event.reply(user.primaryNick + ' was banned on ' + new Date(ban).toUTCString());
|
event.reply(user.primaryNick + ' has been warned ' + warn + ' times, quieted ' + quiet + ' times, and reported ' + report + ' times.');
|
||||||
} else if(quiet != 0 || warn != 0) {
|
|
||||||
event.reply(user.primaryNick + ' has been warned ' + warn + ' times, and quieted ' + quiet + ' times.');
|
|
||||||
_.each(quiets, function(message) {
|
_.each(quiets, function(message) {
|
||||||
event.reply(message);
|
event.reply(message);
|
||||||
});
|
});
|
||||||
_.each(warns, function(message) {
|
_.each(warns, function(message) {
|
||||||
event.reply(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 {
|
} else {
|
||||||
event.reply(user.primaryNick + ' has no record.');
|
event.reply(user.primaryNick + ' has no record.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user