dbot/modules/kick.js

29 lines
851 B
JavaScript
Raw Normal View History

2011-08-22 20:24:23 +02:00
var kick = function(dbot) {
2011-08-22 22:46:43 +02:00
var dbot = dbot;
2011-08-22 20:24:23 +02:00
return {
'listener': function(data) {
if(data.kickee == dbot.name) {
2011-08-22 22:46:43 +02:00
dbot.instance.join(data.channel); // TODO: make interface
2011-08-22 20:24:23 +02:00
dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name);
dbot.db.kicks[name] += 1;
} else {
2011-08-22 22:46:43 +02:00
if(dbot.db.kicks.hasOwnProperty(data.kickee)) {
2011-08-22 20:24:23 +02:00
dbot.db.kicks[data.kickee] = 1;
} else {
dbot.db.kicks[data.kickee] += 1;
}
instance.say(data.channel, data.kickee + '-- (' + data.kickee + ' has been kicked ' + dbot.db.kicks[data.kickee] + ' times)');
}
dbot.save();
},
on: 'KICK'
};
};
exports.fetch = function(dbot) {
return kick(dbot);
};