getajob and youare use valMatch and chanceIn

This commit is contained in:
Luke Slater 2011-08-26 12:46:12 +01:00
parent 908e957db1
commit 3291586d18
2 changed files with 4 additions and 5 deletions

View File

@ -3,8 +3,7 @@ var getAJob = function(dbot) {
return { return {
'listener': function(data) { 'listener': function(data) {
var num = Math.floor(Math.random()*101); if(Number.prototype.chanceIn(1, 50)) {
if(num == 50) {
dbot.say(data.channel, data.user + ': Get a job!'); dbot.say(data.channel, data.user + ': Get a job!');
} }
}, },

View File

@ -3,10 +3,10 @@ var youAre = function(dbot) {
return { return {
'listener': function(data) { 'listener': function(data) {
var key = data.message.match(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/); var key = data.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5);
if(key && Number.prototype.chanceIn(1, 3)) { if(key && key[2] != "" && Number.prototype.chanceIn(1, 3)) {
dbot.say(data.channel, data.user + ': You\'re ' + key[2]); dbot.say(data.channel, data.user + ': You\'re ' + key[2] + '.');
} }
}, },