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 {
'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();

View File

@ -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] + '.');
}
},

2
run.js
View File

@ -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';