mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
find alias notifies
This commit is contained in:
parent
3d92550c76
commit
849067127f
@ -85,6 +85,7 @@ var commands = function(dbot) {
|
||||
|
||||
dbot.api.users.resolveUser(event.server, user, function(err, user) {
|
||||
if(user) {
|
||||
dbot.api.users.getUserAliases(user.id, function(err, aliases) {
|
||||
var ban = 0,
|
||||
latest_ban = {'time':0},
|
||||
latest_unban = {'time':0},
|
||||
@ -93,16 +94,17 @@ var commands = function(dbot) {
|
||||
warn = 0,
|
||||
report = 0,
|
||||
items = {};
|
||||
aliases.push(user.primaryNick);
|
||||
|
||||
// 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(user.primaryNick + ' has been unbanned') ||
|
||||
notify.message.match('issued a warning to ' + user.primaryNick) ||
|
||||
notify.message.match('has quieted ' + user.primaryNick) ||
|
||||
notify.message.match('has reported ' + user.primaryNick)) {
|
||||
_.each(aliases, function(alias) {
|
||||
if(notify.message.match('banned ' + alias) ||
|
||||
notify.message.match(alias + ' has been unbanned') ||
|
||||
notify.message.match('issued a warning to ' + alias) ||
|
||||
notify.message.match('has quieted ' + alias) ||
|
||||
notify.message.match('has reported ' + alias)) {
|
||||
if(notify.type == 'ban') {
|
||||
ban++;
|
||||
if(notify.time > latest_ban.time) {
|
||||
@ -122,6 +124,7 @@ var commands = function(dbot) {
|
||||
}
|
||||
items[notify.time] = notify.message;
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
if(quiet != 0 || warn != 0 || report != 0) {
|
||||
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.');
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
} else {
|
||||
event.reply('never heard of em');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user