3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

find alias notifies

This commit is contained in:
reality 2015-04-25 10:42:30 +00:00
parent 3d92550c76
commit 849067127f

View File

@ -85,6 +85,7 @@ var commands = function(dbot) {
dbot.api.users.resolveUser(event.server, user, function(err, user) { dbot.api.users.resolveUser(event.server, user, function(err, user) {
if(user) { if(user) {
dbot.api.users.getUserAliases(user.id, function(err, aliases) {
var ban = 0, var ban = 0,
latest_ban = {'time':0}, latest_ban = {'time':0},
latest_unban = {'time':0}, latest_unban = {'time':0},
@ -93,16 +94,17 @@ var commands = function(dbot) {
warn = 0, warn = 0,
report = 0, report = 0,
items = {}; items = {};
aliases.push(user.primaryNick);
// 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) || _.each(aliases, function(alias) {
notify.message.match(user.primaryNick + ' has been unbanned') || if(notify.message.match('banned ' + alias) ||
notify.message.match('issued a warning to ' + user.primaryNick) || notify.message.match(alias + ' has been unbanned') ||
notify.message.match('has quieted ' + user.primaryNick) || notify.message.match('issued a warning to ' + alias) ||
notify.message.match('has reported ' + user.primaryNick)) { notify.message.match('has quieted ' + alias) ||
notify.message.match('has reported ' + alias)) {
if(notify.type == 'ban') { if(notify.type == 'ban') {
ban++; ban++;
if(notify.time > latest_ban.time) { if(notify.time > latest_ban.time) {
@ -122,6 +124,7 @@ var commands = function(dbot) {
} }
items[notify.time] = notify.message; items[notify.time] = notify.message;
} }
});
}, function() { }, function() {
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.');
@ -151,6 +154,7 @@ var commands = function(dbot) {
event.reply(user.primaryNick + ' has no record.'); event.reply(user.primaryNick + ' has no record.');
} }
}); });
}.bind(this));
} else { } else {
event.reply('never heard of em'); event.reply('never heard of em');
} }