ability to pass host manually to nunban, and extra info about host in notifies

This commit is contained in:
reality 2018-02-22 16:01:40 +00:00
parent 00ac08a9da
commit 9df86cdd99
3 changed files with 17 additions and 9 deletions

View File

@ -173,6 +173,7 @@ var commands = function(dbot) {
'banner': banner, 'banner': banner,
'banee': banee, 'banee': banee,
'hours': timeout, 'hours': timeout,
'host': host,
'reason': reason 'reason': reason
}); });
} else { } else {
@ -180,11 +181,12 @@ var commands = function(dbot) {
'network': network, 'network': network,
'banner': banner, 'banner': banner,
'banee': banee, 'banee': banee,
'host': host,
'reason': reason 'reason': reason
}); });
} }
// Add qutoe category documenting ban // Add db entry documenting ban
if(this.config.document_bans) { if(this.config.document_bans) {
var id = uuid.v4(); var id = uuid.v4();
var banRecord = { var banRecord = {
@ -237,12 +239,13 @@ var commands = function(dbot) {
'~nunban': function(event) { '~nunban': function(event) {
var unbanee = event.params[1], var unbanee = event.params[1],
host = event.params[2],
unbanner = event.rUser; unbanner = event.rUser;
this.api.networkUnban(event.server, unbanee, unbanner, function(err) { this.api.networkUnban(event.server, unbanee, unbanner, host, function(err) {
if(err) { if(err) {
event.reply(dbot.t('nunban_error', { 'unbanee': unbanee })); event.reply(dbot.t('nunban_error', { 'unbanee': unbanee }));
} }
}); });
}, },

View File

@ -120,11 +120,15 @@ var kick = function(dbot) {
}.bind(this)); }.bind(this));
}, },
'networkUnban': function(server, unbanee, unbanner, callback) { 'networkUnban': function(server, unbanee, unbanner, manualHost, 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 = dbot.config.servers[server].admin_channel; adminChannel = dbot.config.servers[server].admin_channel;
if(!_.isUndefined(manualHost)) {
this.hosts[server][unbanee] = manualHost;
}
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];
@ -136,6 +140,7 @@ var kick = function(dbot) {
var notifyString = dbot.t('nunbanned', { var notifyString = dbot.t('nunbanned', {
'network': network, 'network': network,
'unbanee': unbanee, 'unbanee': unbanee,
'host': host,
'unbanner': unbanner.currentNick 'unbanner': unbanner.currentNick
}); });
dbot.api.report.notify('unban', server, unbanner, adminChannel, notifyString, false, unbanee); dbot.api.report.notify('unban', server, unbanner, adminChannel, notifyString, false, unbanee);

View File

@ -64,7 +64,7 @@
"it": "Attenzione : {banner} ha bandito {banee} da {channel}. Motivo : \"{reason}\"." "it": "Attenzione : {banner} ha bandito {banee} da {channel}. Motivo : \"{reason}\"."
}, },
"tbanned": { "tbanned": {
"en": "Attention: {banner} has banned {banee} from the {network} network for {hours}. The reason given was \"{reason}\".", "en": "Attention: {banner} has banned {banee} (host: {host}) from the {network} network for {hours}. The reason given was \"{reason}\".",
"de": "Achtung: {banner} hat {banee} vom {network} Netzwerk für {hours} Stunden verbannt. Der Grund war \"{reason}\".", "de": "Achtung: {banner} hat {banee} vom {network} Netzwerk für {hours} Stunden verbannt. Der Grund war \"{reason}\".",
"fr": "Attention : {banner} a banni {banee} du réseau {network} pour {hours} heures. Raison donnée : \"{reason}\".", "fr": "Attention : {banner} a banni {banee} du réseau {network} pour {hours} heures. Raison donnée : \"{reason}\".",
"it": "Attenzione : {banner} ha bandito {banee} dalla rete {network} per {hours} ora/e. Motivo : \"{reason}\"." "it": "Attenzione : {banner} ha bandito {banee} dalla rete {network} per {hours} ora/e. Motivo : \"{reason}\"."
@ -76,7 +76,7 @@
"it": "Sei stato bandito dalla rete {network} per {hours} ora/e da {banner}. Motivo: \"{reason}\". Puoi ricongiungere {admin_channel} per ulteriori informazioni o discutere sulla messa al bando." "it": "Sei stato bandito dalla rete {network} per {hours} ora/e da {banner}. Motivo: \"{reason}\". Puoi ricongiungere {admin_channel} per ulteriori informazioni o discutere sulla messa al bando."
}, },
"nbanned": { "nbanned": {
"en": "Attention: {banner} has banned {banee} from the {network} network. The reason given was \"{reason}\".", "en": "Attention: {banner} has banned {banee} (host: {host}) from the {network} network. The reason given was \"{reason}\".",
"cy": "Sylw: {banner} wedi gwahardd {banee} ledled y rhwydwaith. Y rheswm a roddwyd oedd: \"{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}\".", "de": "Achtung: {banner} hat {banee} auf dem gesamten Netzwerk gebannt. Grund: \"{reason}\".",
"fr": "Attention : {banner} a banni {banee} du réseau {network}. Raison donnée : \"{reason}\".", "fr": "Attention : {banner} a banni {banee} du réseau {network}. Raison donnée : \"{reason}\".",
@ -95,7 +95,7 @@
"it": "{user} sembra non essere connesso a questo server" "it": "{user} sembra non essere connesso a questo server"
}, },
"nunbanned": { "nunbanned": {
"en": "Attention: {unbanee} has been unbanned from the {network} network by {unbanner}.", "en": "Attention: {unbanee} (host: {host}) has been unbanned from the {network} network by {unbanner}.",
"de": "Achtung: {unbanee} wurde im {network} Netzwerk durch {unbanner} entsperrt.", "de": "Achtung: {unbanee} wurde im {network} Netzwerk durch {unbanner} entsperrt.",
"fr": "Attention : {unbanee} a été débanni du réseau {network} par {unbanner}.", "fr": "Attention : {unbanee} a été débanni du réseau {network} par {unbanner}.",
"it": "Attenzione : {unbanee} è stato riammesso alla rete {network} da {unbanner}." "it": "Attenzione : {unbanee} è stato riammesso alla rete {network} da {unbanner}."