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

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,
'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 }));
}
});
},

View File

@ -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);

View File

@ -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}."