forked from GitHub/dbot
~nban no longer adds redundant +b if user was killed
This commit is contained in:
parent
ed69582c7a
commit
f3dcc0e693
@ -121,7 +121,10 @@ var commands = function (dbot) {
|
|||||||
dbot.api.nickserv.getUserHost(event.server, banee, function (host) {
|
dbot.api.nickserv.getUserHost(event.server, banee, function (host) {
|
||||||
// Add host record entry
|
// Add host record entry
|
||||||
if (host) {
|
if (host) {
|
||||||
|
var didKill = false;
|
||||||
|
|
||||||
if ((reason.match('#line') || reason.match('#specialk') || reason.match('#kline')) && _.include(dbot.access.moderator(), event.rUser.primaryNick)) {
|
if ((reason.match('#line') || reason.match('#specialk') || reason.match('#kline')) && _.include(dbot.access.moderator(), event.rUser.primaryNick)) {
|
||||||
|
didKill = true;
|
||||||
var t = ' !P ';
|
var t = ' !P ';
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
t = ' !T ' + (timeout * 60);
|
t = ' !T ' + (timeout * 60);
|
||||||
@ -129,6 +132,8 @@ var commands = function (dbot) {
|
|||||||
dbot.say(event.server, 'operserv', 'akill add ' + banee + t + banee + ' banned by ' + banner + ': ' + reason);
|
dbot.say(event.server, 'operserv', 'akill add ' + banee + t + banee + ' banned by ' + banner + ': ' + reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not ban if user was killed - redundant
|
||||||
|
if(!didKill) {
|
||||||
// Ban from current channel first
|
// Ban from current channel first
|
||||||
this.api.ban(server, host, event.channel);
|
this.api.ban(server, host, event.channel);
|
||||||
this.api.kick(server, banee, event.channel, reason +
|
this.api.kick(server, banee, event.channel, reason +
|
||||||
@ -154,6 +159,7 @@ var commands = function (dbot) {
|
|||||||
}
|
}
|
||||||
.bind(this);
|
.bind(this);
|
||||||
banChannel(channels);
|
banChannel(channels);
|
||||||
|
}
|
||||||
|
|
||||||
this.hosts[event.server][banee] = host;
|
this.hosts[event.server][banee] = host;
|
||||||
|
|
||||||
@ -172,10 +178,13 @@ var commands = function (dbot) {
|
|||||||
timeout += ' hours';
|
timeout += ' hours';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not schedule unbans if the user was killed as no ban was put in place
|
||||||
|
if(!didKill) {
|
||||||
if (!_.has(this.tempBans, event.server))
|
if (!_.has(this.tempBans, event.server))
|
||||||
this.tempBans[event.server] = {};
|
this.tempBans[event.server] = {};
|
||||||
this.tempBans[event.server][banee] = msTimeout;
|
this.tempBans[event.server][banee] = msTimeout;
|
||||||
this.internalAPI.addTempBan(event.server, banee, msTimeout);
|
this.internalAPI.addTempBan(event.server, banee, msTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
var notifyString = dbot.t('tbanned', {
|
var notifyString = dbot.t('tbanned', {
|
||||||
'network': network,
|
'network': network,
|
||||||
|
Loading…
Reference in New Issue
Block a user