more shit i cant be bothered to finish yet on [#261]

This commit is contained in:
reality 2013-05-06 21:56:45 +00:00
parent 80b586ba60
commit cdfe353b94
4 changed files with 92 additions and 4 deletions

View File

@ -1,6 +1,9 @@
var _ = require('underscore')._;
var commands = function(dbot) {
var commands = {
/*** Kick Management ***/
'~ckick': function(event) {
var server = event.server,
kicker = event.user,
@ -9,7 +12,8 @@ var commands = function(dbot) {
reason = event.input[3];
this.api.kick(server, kickee, channel, reason + ' (requested by ' + kicker + ')');
dbot.api.report.notify(server, channel, kicker, kickee, dbot.t('ckicked', {
dbot.api.report.notify(server, channel, dbot.t('ckicked', {
'kicker': kicker,
'kickee': kickee,
'channel': channel,
@ -17,6 +21,80 @@ var commands = function(dbot) {
}));
},
'~cban': function(event) {
var server = event.server,
banner = event.user,
banee = event.input[2],
channel = event.input[1],
reason = event.input[3];
this.api.ban(server, banee, channel);
this.api.kick(server, kickee, channel, reason + ' (requested by ' + banner + ')');
dbot.api.report.notify(server, channel, dbot.t('cbanned', {
'banner': banner,
'banee': banee,
'channel': channel,
'reason': reason
}));
},
'~cquiet': function(event) {
var server = event.server,
quieter = event.user,
quietee = event.input[2],
channel = event.input[1],
reason = event.input[3];
this.api.quiet(server, quietee, channel);
dbot.api.report(server, channel, dbot.t('cquieted', {
'quieter': quieter,
'quietee': quietee,
'channel': channel,
'reason': reason
}));
},
'~nquiet': function(event) {
var server = event.server,
quieter = event.user,
quietee = event.input[1],
channels = dbot.config.servers[server].channels,
reason = event.input[2];
_.each(channels, function(channel) {
this.api.quiet(server, quietee, channel);
}, this);
dbot.api.report(server, channel, dbot.t('nquieted', {
'quieter': quieter,
'quietee': quietee,
'reason': reason
}));
},
// Kick and ban from all channels on the network.
'~nban': function(event) {
var server = event.server,
banner = event.user,
banee = event.input[1],
reason = event.input[2],
channels = dbot.config.servers[server].channels;
_.each(channels, function(channel) {
this.api.ban(server, banee, channel);
this.api.kick(server, banee, channel, reason +
' (network-wide ban requested by ' + banner + ')');
}, this);
dbot.api.report.notify(server, this.config.admin_channels[event.server], dbot.t('nbanned', {
'banner': banner,
'banee': banee,
'reason': reason
}));
},
/*** Kick Stats ***/
// Give the number of times a given user has been kicked and has kicked
@ -67,8 +145,12 @@ var commands = function(dbot) {
}
};
commands['~ckick'].access = 'moderator';
_.each(commands, function(command) {
command.access = 'moderator';
});
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
commands['~nban'].regex = [/^~nban ([^ ]+) (.+)$/, 3];
return commands;
};

View File

@ -4,5 +4,8 @@
"help": "http://github.com/reality/depressionbot/blob/master/modules/kick/README.md",
"ignorable": true,
"countSilently": true,
"admin_channels": {
"aberwiki": "#fishbox"
},
"chanserv": "ChanServ"
}

View File

@ -17,4 +17,7 @@
"cy": "Ni ddylech cicio {botname}",
"nl": "Gij zult {botname} niet kicken"
}
"nbanned": {
"en": "Attention: {banner} has banned {banee} network-wide. The reason given was \"{reason}.\""
}
}

View File

@ -2,7 +2,7 @@ var _ = require('underscore')._;
var report = function(dbot) {
this.api = {
'notify': function(server, channel, reporter, reported, message) {
'notify': function(server, channel, message) {
var channel = dbot.instance.connections[server].channels[channel];
var ops = _.filter(channel.nicks, function(user) {
if(this.config.notifyVoice) {
@ -27,7 +27,7 @@ var report = function(dbot) {
if(_.has(event.allChannels, channelName)) {
if(dbot.api.users.isChannelUser(event.server, nick, channelName, true)) {
nick = dbot.api.users.resolveUser(event.server, nick, true);
this.api.notify(event.server, channelName, event.user, nick, dbot.t('report', {
this.api.notify(event.server, channelName, dbot.t('report', {
'reporter': event.user,
'reported': nick,
'channel': channelName,