kick uses root admin_channel directive [#513]

This commit is contained in:
reality 2013-06-30 17:22:16 +00:00
parent fee7fedbf7
commit 2c2e1aefa2
2 changed files with 34 additions and 30 deletions

View File

@ -48,7 +48,7 @@ var commands = function(dbot) {
timeout = event.input[1], timeout = event.input[1],
banee = event.input[2], banee = event.input[2],
reason = event.input[3], reason = event.input[3],
adminChannel = this.config.admin_channel[event.server]; adminChannel = dbot.config.servers[server].admin_channel,
channels = dbot.config.servers[server].channels, channels = dbot.config.servers[server].channels,
network = event.server; network = event.server;
@ -107,8 +107,11 @@ var commands = function(dbot) {
} }
// Notify moderators, banee // Notify moderators, banee
if(this.config.admin_channel[event.server]) { if(!_.isUndefined(adminChannel)) {
channels = _.without(channels, adminChannel); channels = _.without(channels, adminChannel);
} else {
adminChannel = event.channel.name;
}
dbot.api.report.notify(server, adminChannel, notifyString); dbot.api.report.notify(server, adminChannel, notifyString);
dbot.say(event.server, adminChannel, notifyString); dbot.say(event.server, adminChannel, notifyString);
@ -130,7 +133,6 @@ var commands = function(dbot) {
'admin_channel': adminChannel 'admin_channel': adminChannel
})); }));
} }
}
// Ban the user from all channels // Ban the user from all channels
var i = 0; var i = 0;

View File

@ -24,13 +24,16 @@ var kick = function(dbot) {
'networkUnban': function(server, unbanee, unbanner, callback) { 'networkUnban': function(server, unbanee, unbanner, callback) {
var channels = dbot.config.servers[server].channels, var channels = dbot.config.servers[server].channels,
network = this.config.network_name[server] || server, network = this.config.network_name[server] || server,
adminChannel = this.config.admin_channel[server]; adminChannel = dbot.config.servers[server].admin_channel;
if(_.has(this.hosts, server) && _.has(this.hosts[server], unbanee)) { if(_.has(this.hosts, server) && _.has(this.hosts[server], unbanee)) {
var host = this.hosts[server][unbanee]; var host = this.hosts[server][unbanee];
// Notify Staff // Notify Staff
if(!_.isUndefined(adminChannel)) { if(_.isUndefined(adminChannel)) {
adminChannel = event.channel.name;
}
var notifyString = dbot.t('nunbanned', { var notifyString = dbot.t('nunbanned', {
'network': network, 'network': network,
'unbanee': unbanee, 'unbanee': unbanee,
@ -38,7 +41,6 @@ var kick = function(dbot) {
}); });
dbot.api.report.notify(server, adminChannel, notifyString); dbot.api.report.notify(server, adminChannel, notifyString);
dbot.say(server, adminChannel, notifyString); dbot.say(server, adminChannel, notifyString);
}
// Notify Unbanee // Notify Unbanee
dbot.say(server, unbanee, dbot.t('nunban_notify', { dbot.say(server, unbanee, dbot.t('nunban_notify', {