From 64fd389418b3cabd08287e8a99082fd8d1763826 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Fri, 20 Apr 2012 13:48:12 +0100 Subject: [PATCH] badwords changes --- modules/badwords.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/modules/badwords.js b/modules/badwords.js index 8d7ab8c..d53dab0 100644 --- a/modules/badwords.js +++ b/modules/badwords.js @@ -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