Right, sessionData isn't in the DB.

This commit is contained in:
Luke Slater 2012-04-19 12:20:57 +01:00
parent eb683369f2
commit 27d5c1aa61

View File

@ -12,14 +12,14 @@ var badwords = function(dbot) {
data.channel = '#42'; data.channel = '#42';
badWordLock = true; badWordLock = true;
dbot.db.sessionData.badwords.finished = false; dbot.sessionData.badwords.finished = false;
dbot.say('bots', 'badwords ' + data.channel + ' list'); dbot.say('bots', 'badwords ' + data.channel + ' list');
dbot.instance.addListener('PRIVMSG', function(data) { dbot.instance.addListener('PRIVMSG', function(data) {
if(data.channel === 'bots') { if(data.channel === 'bots') {
if(data.message.indexOf('bad words list is empty') != -1) { if(data.message.indexOf('bad words list is empty') != -1) {
dbot.db.sessionData.badwords.count = 0; dbot.sessionData.badwords.count = 0;
dbot.db.sessionData.badwords.finished = true; dbot.sessionData.badwords.finished = true;
} else { } else {
var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2); var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2);
dbot.say('reality', wordMatch[1]); dbot.say('reality', wordMatch[1]);
@ -27,7 +27,7 @@ var badwords = function(dbot) {
} }
}); });
dbot.db.sessionData.badwords = {}; dbot.sessionData.badwords = {};
badWordLock = false; badWordLock = false;
} }
} }
@ -35,8 +35,8 @@ var badwords = function(dbot) {
return { return {
'onLoad': function() { 'onLoad': function() {
if(dbot.db.sessionData.hasOwnProperty('badwords')) { if(dbot.sessionData.hasOwnProperty('badwords')) {
dbot.db.sessionData.badwords = {}; dbot.sessionData.badwords = {};
} }
return commands; return commands;