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

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,29 +107,31 @@ 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);
if(!_.isUndefined(timeout)) { if(!_.isUndefined(timeout)) {
dbot.say(event.server, banee, dbot.t('tbanned_notify', { dbot.say(event.server, banee, dbot.t('tbanned_notify', {
'network': network, 'network': network,
'banner': banner, 'banner': banner,
'reason': reason, 'reason': reason,
'hours': timeout, 'hours': timeout,
'admin_channel': adminChannel 'admin_channel': adminChannel
})); }));
} else { } else {
dbot.say(event.server, banee, dbot.t('nbanned_notify', { dbot.say(event.server, banee, dbot.t('nbanned_notify', {
'network': network, 'network': network,
'banner': banner, 'banner': banner,
'reason': reason, 'reason': reason,
'hours': timeout, 'hours': timeout,
'admin_channel': adminChannel 'admin_channel': adminChannel
})); }));
}
} }
// Ban the user from all channels // Ban the user from all channels

View File

@ -24,22 +24,24 @@ 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)) {
var notifyString = dbot.t('nunbanned', { adminChannel = event.channel.name;
'network': network,
'unbanee': unbanee,
'unbanner': unbanner
});
dbot.api.report.notify(server, adminChannel, notifyString);
dbot.say(server, adminChannel, notifyString);
} }
var notifyString = dbot.t('nunbanned', {
'network': network,
'unbanee': unbanee,
'unbanner': unbanner
});
dbot.api.report.notify(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', {
'network': network, 'network': network,