2013-01-12 23:53:13 +01:00
|
|
|
var _ = require('underscore')._;
|
|
|
|
|
2012-12-11 17:04:52 +01:00
|
|
|
var kick = function(dbot) {
|
2013-06-09 23:07:17 +02:00
|
|
|
this.hosts = dbot.db.hosts;
|
2013-04-14 16:34:30 +02:00
|
|
|
|
2013-02-05 20:22:22 +01:00
|
|
|
this.api = {
|
|
|
|
'ban': function(server, user, channel) {
|
2013-04-14 17:36:48 +02:00
|
|
|
dbot.say(server, this.config.chanserv, 'ban ' + channel + ' ' + user)
|
2013-02-05 20:22:22 +01:00
|
|
|
},
|
|
|
|
|
2013-04-14 17:36:48 +02:00
|
|
|
'quiet': function(server, user, channel) {
|
|
|
|
dbot.say(server, this.config.chanserv, 'quiet ' + channel + ' ' + user)
|
2013-04-14 17:41:40 +02:00
|
|
|
},
|
2013-04-14 17:36:48 +02:00
|
|
|
|
2013-02-05 20:22:22 +01:00
|
|
|
'kick': function(server, user, channel, msg) {
|
2013-02-05 20:26:29 +01:00
|
|
|
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
|
2013-02-05 20:22:22 +01:00
|
|
|
}
|
|
|
|
};
|
2013-01-15 00:00:16 +01:00
|
|
|
|
|
|
|
this.listener = function(event) {
|
|
|
|
if(event.kickee == dbot.config.name) {
|
|
|
|
dbot.instance.join(event, event.channel);
|
|
|
|
event.reply(dbot.t('kicked_dbot', { 'botname': dbot.config.name }));
|
|
|
|
dbot.db.kicks[dbot.config.name] += 1;
|
|
|
|
} else {
|
|
|
|
if(!_.has(dbot.db.kicks, event.kickee)) {
|
|
|
|
dbot.db.kicks[event.kickee] = 1;
|
2012-12-11 17:04:52 +01:00
|
|
|
} else {
|
2013-01-15 00:00:16 +01:00
|
|
|
dbot.db.kicks[event.kickee] += 1;
|
|
|
|
}
|
2012-12-11 17:04:52 +01:00
|
|
|
|
2013-01-15 00:00:16 +01:00
|
|
|
if(!_.has(dbot.db.kickers, event.user)) {
|
|
|
|
dbot.db.kickers[event.user] = 1;
|
|
|
|
} else {
|
|
|
|
dbot.db.kickers[event.user] += 1;
|
2012-12-11 17:04:52 +01:00
|
|
|
}
|
2013-01-15 00:00:16 +01:00
|
|
|
|
2013-04-14 16:34:30 +02:00
|
|
|
if(!this.config.countSilently) {
|
|
|
|
event.reply(event.kickee + '-- (' + dbot.t('user_kicks', {
|
|
|
|
'user': event.kickee,
|
|
|
|
'kicks': dbot.db.kicks[event.kickee],
|
|
|
|
'kicked': dbot.db.kickers[event.kickee]
|
|
|
|
}) + ')');
|
|
|
|
}
|
2013-01-15 00:00:16 +01:00
|
|
|
}
|
2013-04-14 17:00:15 +02:00
|
|
|
}.bind(this);
|
2013-01-15 00:00:16 +01:00
|
|
|
this.on = 'KICK';
|
2012-12-11 17:04:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
2013-01-15 00:00:16 +01:00
|
|
|
return new kick(dbot);
|
2012-12-11 17:04:52 +01:00
|
|
|
};
|