From 9df86cdd999fd9fac084f5016d740e7479cc51a2 Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 22 Feb 2018 16:01:40 +0000 Subject: [PATCH] ability to pass host manually to nunban, and extra info about host in notifies --- modules/kick/commands.js | 13 ++++++++----- modules/kick/kick.js | 7 ++++++- modules/kick/strings.json | 6 +++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index e95a849..bf2baea 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -173,6 +173,7 @@ var commands = function(dbot) { 'banner': banner, 'banee': banee, 'hours': timeout, + 'host': host, 'reason': reason }); } else { @@ -180,11 +181,12 @@ var commands = function(dbot) { 'network': network, 'banner': banner, 'banee': banee, + 'host': host, 'reason': reason }); } - // Add qutoe category documenting ban + // Add db entry documenting ban if(this.config.document_bans) { var id = uuid.v4(); var banRecord = { @@ -237,12 +239,13 @@ var commands = function(dbot) { '~nunban': function(event) { var unbanee = event.params[1], + host = event.params[2], unbanner = event.rUser; - this.api.networkUnban(event.server, unbanee, unbanner, function(err) { - if(err) { - event.reply(dbot.t('nunban_error', { 'unbanee': unbanee })); - } + this.api.networkUnban(event.server, unbanee, unbanner, host, function(err) { + if(err) { + event.reply(dbot.t('nunban_error', { 'unbanee': unbanee })); + } }); }, diff --git a/modules/kick/kick.js b/modules/kick/kick.js index 890e637..3f7a386 100644 --- a/modules/kick/kick.js +++ b/modules/kick/kick.js @@ -120,11 +120,15 @@ var kick = function(dbot) { }.bind(this)); }, - 'networkUnban': function(server, unbanee, unbanner, callback) { + 'networkUnban': function(server, unbanee, unbanner, manualHost, callback) { var channels = dbot.config.servers[server].channels, network = this.config.network_name[server] || server, 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)) { var host = this.hosts[server][unbanee]; @@ -136,6 +140,7 @@ var kick = function(dbot) { var notifyString = dbot.t('nunbanned', { 'network': network, 'unbanee': unbanee, + 'host': host, 'unbanner': unbanner.currentNick }); dbot.api.report.notify('unban', server, unbanner, adminChannel, notifyString, false, unbanee); diff --git a/modules/kick/strings.json b/modules/kick/strings.json index 51c70b0..b114cfe 100644 --- a/modules/kick/strings.json +++ b/modules/kick/strings.json @@ -64,7 +64,7 @@ "it": "Attenzione : {banner} ha bandito {banee} da {channel}. Motivo : \"{reason}\"." }, "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}\".", "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}\"." @@ -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." }, "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}\".", "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}\".", @@ -95,7 +95,7 @@ "it": "{user} sembra non essere connesso a questo server" }, "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.", "fr": "Attention : {unbanee} a été débanni du réseau {network} par {unbanner}.", "it": "Attenzione : {unbanee} è stato riammesso alla rete {network} da {unbanner}."