3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 19:52:36 +01:00

~nban no longer bans from network admin channel, posts notification in network admin chan

This commit is contained in:
reality 2013-06-08 18:34:29 +00:00
parent cd4b9460b1
commit 0421316002

View File

@ -45,21 +45,9 @@ var commands = function(dbot) {
banner = event.user,
banee = event.input[1],
reason = event.input[2],
adminChannel = this.config.admin_channels[event.server];
channels = dbot.config.servers[server].channels;
var i = 0;
var banChannel = function(channels) {
if(i >= channels.length) return;
var channel = channels[i];
this.api.ban(server, banee, channel);
this.api.kick(server, banee, channel, reason +
' (network-wide ban requested by ' + banner + ')');
setTimeout(function() {
i++; banChannel(channels);
}, 1000);
}.bind(this);
banChannel(channels);
var notifyString = dbot.t('nbanned', {
'banner': banner,
'banee': banee,
@ -79,11 +67,27 @@ var commands = function(dbot) {
notifyString += ' ' + dbot.t('quote_recorded', { 'user': banee });
}
var notifyChannel = event.channel.name;
// Notify moderators, banee
if(this.config.admin_channels[event.server]) {
notifyChannel = this.config.admin_channels[event.server];
channels = _.without(channels, notifyChannel);
dbot.api.report.notify(server, adminChannel, notifyString);
dbot.say(event.server, adminChannel, notifyString);
}
dbot.api.report.notify(server, notifyChannel, notifyString);
// Ban the user from all channels
var i = 0;
var banChannel = function(channels) {
if(i >= channels.length) return;
var channel = channels[i];
this.api.ban(server, banee, channel);
this.api.kick(server, banee, channel, reason +
' (network-wide ban requested by ' + banner + ')');
setTimeout(function() {
i++; banChannel(channels);
}, 1000);
}.bind(this);
banChannel(channels);
},
/*** Kick Stats ***/