youare doesn't respond to aisbot, reality.js uses valMatch.

This commit is contained in:
Luke Slater 2011-08-26 15:34:49 +01:00
parent 3291586d18
commit 86a428a5a2
3 changed files with 6 additions and 5 deletions

View File

@ -3,13 +3,14 @@ var reality = function(dbot) {
return { return {
'listener': function(data, params) { 'listener': function(data, params) {
// Ternary for I/reality doesn't seem to work with the regex. Investigate.
if(data.user == 'reality') { 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 { } 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.db.realiPuns.push('reality ' + once[1] + '.');
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.'); dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
dbot.save(); dbot.save();

View File

@ -5,7 +5,7 @@ var youAre = function(dbot) {
'listener': function(data) { 'listener': function(data) {
var key = data.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); 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] + '.'); dbot.say(data.channel, data.user + ': You\'re ' + key[2] + '.');
} }
}, },

2
run.js
View File

@ -2,7 +2,7 @@ require('./snippets');
var fs = require('fs'); var fs = require('fs');
var jsbot = require('./jsbot'); 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) { var DBot = function(dModules, quotes) {
this.admin = 'reality'; this.admin = 'reality';