~nunban command

This commit is contained in:
reality 2013-06-09 22:50:11 +00:00
parent 2b7b67b894
commit ab520e625a
3 changed files with 69 additions and 9 deletions

View File

@ -46,7 +46,12 @@ var commands = function(dbot) {
banee = event.input[1],
reason = event.input[2],
adminChannel = this.config.admin_channel[event.server];
channels = dbot.config.servers[server].channels;
channels = dbot.config.servers[server].channels,
network = event.server;
if(this.config.network_name[event.server]) {
network = this.config.network_name[event.server];
}
dbot.api.nickserv.getUserHost(event.server, banee, function(host) {
// Add host record entry
@ -55,6 +60,7 @@ var commands = function(dbot) {
// Create notify string
var notifyString = dbot.t('nbanned', {
'network': network,
'banner': banner,
'banee': banee,
'reason': reason
@ -80,11 +86,6 @@ var commands = function(dbot) {
dbot.api.report.notify(server, adminChannel, notifyString);
dbot.say(event.server, adminChannel, notifyString);
var network = event.server;
if(this.config.network_name[event.server]) {
network = this.config.network_name[event.server];
}
dbot.say(event.server, banee, dbot.t('nbanned_notify', {
'network': network,
'banner': banner,
@ -109,6 +110,52 @@ var commands = function(dbot) {
}.bind(this));
},
'~nunban': function(event) {
var unbanee = event.params[1],
unbanner = event.user,
adminChannel = this.config.admin_channel[event.server],
channels = dbot.config.servers[event.server].channels,
network = event.server;
if(this.config.network_name[event.server]) {
network = this.config.network_name[event.server];
}
if(_.has(this.hosts, event.server) && _.has(this.hosts[event.server], unbanee)) {
var host = this.hosts[event.server][unbanee];
var notifyString = dbot.t('nunbanned', {
'network': network,
'unbanee': unbanee,
'unbanner': unbanner
});
if(this.config.admin_channel[event.server]) {
dbot.api.report.notify(event.server, adminChannel, notifyString);
dbot.say(event.server, adminChannel, notifyString);
}
dbot.say(event.server, unbanee, dbot.t('nunban_notify', {
'network': network,
'unbanee': unbanee,
'unbanner': unbanner
}));
var i = 0;
var unbanChannel = function(channels) {
if(i >= channels.length) return;
var channel = channels[i];
this.api.unban(event.server, host, channel);
setTimeout(function() {
i++; unbanChannel(channels);
}, 1000);
}.bind(this);
unbanChannel(channels);
} else {
event.reply(dbot.t('nunban_error', { 'unbanee': unbanee }));
}
},
/*** Kick Stats ***/
// Give the number of times a given user has been kicked and has kicked

View File

@ -5,15 +5,19 @@ var kick = function(dbot) {
this.api = {
'ban': function(server, user, channel) {
dbot.say(server, this.config.chanserv, 'ban ' + channel + ' ' + user)
dbot.say(server, this.config.chanserv, 'ban ' + channel + ' ' + user);
},
'quiet': function(server, user, channel) {
dbot.say(server, this.config.chanserv, 'quiet ' + channel + ' ' + user)
dbot.say(server, this.config.chanserv, 'quiet ' + channel + ' ' + user);
},
'kick': function(server, user, channel, msg) {
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
},
'unban': function(server, host, channel) {
dbot.say(server, this.config.chanserv, 'unban ' + channel + ' *!*@' + host);
}
};

View File

@ -26,7 +26,7 @@
"de": "Achtung: {banner} hat {banee} von {channel} gebannt. Grund: \"{reason}.\""
},
"nbanned": {
"en": "Attention: {banner} has banned {banee} network-wide. The reason given was \"{reason}.\"",
"en": "Attention: {banner} has banned {banee} from the {network} network. The reason given was \"{reason}.\"",
"cy": "Sylw: {banner} wedi gwahardd {banee} ledled y rhwydwaith. Y rheswm a roddwyd oedd: \"{reason}.\"",
"de": "Achtung: {banner} hat {banee} auf dem gesamten Netzwerk gebannt. Grund: \"{reason}.\""
},
@ -38,6 +38,15 @@
"cy": "Cafodd {banee} ei wahardd o'r rhwydwaith gan {banner} ar {time}. Y rheswm a roddwyd oedd: \"{reason}.\"",
"de": "{banee} wurde von {banner} auf dem gesamten Netzwerk um {time} gebannt. Grund: \"{reason}.\""
},
"nunbanned": {
"en": "Attention: {unbanee} has been unbanned from the {network} network by {unbanner}."
},
"nunban_notify": {
"en": "You have been unbanned from the {network} network by {unbanner}."
},
"nunban_error": {
"en": "It appears {unbanee} was not banned using the ~nban command."
},
"quote_recorded": {
"en": "This has been recorded in ~ban_{user}.",
"cy": "Mae hyn wedi cael ei gofnodi yn ~ban_{user}.",