From 86a428a5a26288ef4a00f057b40208fc562ae4c3 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Fri, 26 Aug 2011 15:34:49 +0100 Subject: [PATCH] youare doesn't respond to aisbot, reality.js uses valMatch. --- modules/reality.js | 7 ++++--- modules/youare.js | 2 +- run.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/reality.js b/modules/reality.js index 22f953d..3a6a160 100644 --- a/modules/reality.js +++ b/modules/reality.js @@ -3,13 +3,14 @@ var reality = function(dbot) { return { 'listener': function(data, params) { + // Ternary for I/reality doesn't seem to work with the regex. Investigate. if(data.user == 'reality') { - var once = data.message.match(/^I ([\d\w\s,'-]* once)/); + var once = data.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2); } else { - var once = data.message.match(/^reality ([\d\w\s,'-]* once)/); + var once = data.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2); } - if(once != null) { + if(once) { dbot.db.realiPuns.push('reality ' + once[1] + '.'); dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.'); dbot.save(); diff --git a/modules/youare.js b/modules/youare.js index b033e6b..24c2b81 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -5,7 +5,7 @@ var youAre = function(dbot) { 'listener': function(data) { var key = data.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); - if(key && key[2] != "" && Number.prototype.chanceIn(1, 3)) { + if(key && key[2] != "" && Number.prototype.chanceIn(1, 10) && data.user != 'aisbot') { dbot.say(data.channel, data.user + ': You\'re ' + key[2] + '.'); } }, diff --git a/run.js b/run.js index 5eeca27..7cce63d 100644 --- a/run.js +++ b/run.js @@ -2,7 +2,7 @@ require('./snippets'); var fs = require('fs'); var jsbot = require('./jsbot'); -var modules = ['user', 'admin', 'puns', 'kick', 'reality', 'karma']; +var modules = ['user', 'admin', 'puns', 'kick', 'reality', 'karma', 'youare']; var DBot = function(dModules, quotes) { this.admin = 'reality';