3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 19:52:36 +01:00

badwords changes

This commit is contained in:
Luke Slater 2012-04-20 13:48:12 +01:00
parent 2954df3a52
commit 64fd389418

View File

@ -12,21 +12,10 @@ var badwords = function(dbot) {
data.channel = '#42';
badWordLock = true;
dbot.sessionData.badwords.finished = false;
dbot.sessionData.badwords.waiting = true;
dbot.say('bots', 'badwords ' + data.channel + ' list');
dbot.instance.addListener('PRIVMSG', function(data) {
if(data.channel === 'bots') {
if(data.message.indexOf('bad words list is empty') != -1) {
dbot.sessionData.badwords.count = 0;
dbot.sessionData.badwords.finished = true;
} else {
var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2);
dbot.say('reality', wordMatch[1]);
}
}
});
dbot.instance.addListener('PRIVMSG',
dbot.sessionData.badwords = {};
badWordLock = false;
}
@ -42,6 +31,20 @@ var badwords = function(dbot) {
return commands;
},
'listener': function(data) {
if(data.channel === 'bots') {
if(data.message.indexOf('bad words list is empty') != -1) {
dbot.sessionData.badwords.count = 0;
dbot.sessionData.badwords.finished = true;
} else {
var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2);
dbot.say('reality', wordMatch[1]);
}
}
},
'on': 'PRIVMSG',
'name': name,
'ignorable': true