mirror of
https://github.com/reality/dbot.git
synced 2025-01-24 11:04:13 +01:00
~nunban command
This commit is contained in:
parent
2b7b67b894
commit
ab520e625a
@ -46,7 +46,12 @@ var commands = function(dbot) {
|
|||||||
banee = event.input[1],
|
banee = event.input[1],
|
||||||
reason = event.input[2],
|
reason = event.input[2],
|
||||||
adminChannel = this.config.admin_channel[event.server];
|
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) {
|
dbot.api.nickserv.getUserHost(event.server, banee, function(host) {
|
||||||
// Add host record entry
|
// Add host record entry
|
||||||
@ -55,6 +60,7 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
// Create notify string
|
// Create notify string
|
||||||
var notifyString = dbot.t('nbanned', {
|
var notifyString = dbot.t('nbanned', {
|
||||||
|
'network': network,
|
||||||
'banner': banner,
|
'banner': banner,
|
||||||
'banee': banee,
|
'banee': banee,
|
||||||
'reason': reason
|
'reason': reason
|
||||||
@ -80,11 +86,6 @@ var commands = function(dbot) {
|
|||||||
dbot.api.report.notify(server, adminChannel, notifyString);
|
dbot.api.report.notify(server, adminChannel, notifyString);
|
||||||
dbot.say(event.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', {
|
dbot.say(event.server, banee, dbot.t('nbanned_notify', {
|
||||||
'network': network,
|
'network': network,
|
||||||
'banner': banner,
|
'banner': banner,
|
||||||
@ -109,6 +110,52 @@ var commands = function(dbot) {
|
|||||||
}.bind(this));
|
}.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 ***/
|
/*** Kick Stats ***/
|
||||||
|
|
||||||
// Give the number of times a given user has been kicked and has kicked
|
// Give the number of times a given user has been kicked and has kicked
|
||||||
|
@ -5,15 +5,19 @@ var kick = function(dbot) {
|
|||||||
|
|
||||||
this.api = {
|
this.api = {
|
||||||
'ban': function(server, user, channel) {
|
'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) {
|
'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) {
|
'kick': function(server, user, channel, msg) {
|
||||||
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
|
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
|
||||||
|
},
|
||||||
|
|
||||||
|
'unban': function(server, host, channel) {
|
||||||
|
dbot.say(server, this.config.chanserv, 'unban ' + channel + ' *!*@' + host);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"de": "Achtung: {banner} hat {banee} von {channel} gebannt. Grund: \"{reason}.\""
|
"de": "Achtung: {banner} hat {banee} von {channel} gebannt. Grund: \"{reason}.\""
|
||||||
},
|
},
|
||||||
"nbanned": {
|
"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}.\"",
|
"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}.\""
|
||||||
},
|
},
|
||||||
@ -38,6 +38,15 @@
|
|||||||
"cy": "Cafodd {banee} ei wahardd o'r rhwydwaith gan {banner} ar {time}. Y rheswm a roddwyd oedd: \"{reason}.\"",
|
"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}.\""
|
"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": {
|
"quote_recorded": {
|
||||||
"en": "This has been recorded in ~ban_{user}.",
|
"en": "This has been recorded in ~ban_{user}.",
|
||||||
"cy": "Mae hyn wedi cael ei gofnodi yn ~ban_{user}.",
|
"cy": "Mae hyn wedi cael ei gofnodi yn ~ban_{user}.",
|
||||||
|
Loading…
Reference in New Issue
Block a user