diff --git a/modules/getajob.js b/modules/getajob.js index 0b3d282..7a6d052 100644 --- a/modules/getajob.js +++ b/modules/getajob.js @@ -3,8 +3,7 @@ var getAJob = function(dbot) { return { 'listener': function(data) { - var num = Math.floor(Math.random()*101); - if(num == 50) { + if(Number.prototype.chanceIn(1, 50)) { dbot.say(data.channel, data.user + ': Get a job!'); } }, diff --git a/modules/youare.js b/modules/youare.js index 607c5e2..b033e6b 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -3,10 +3,10 @@ var youAre = function(dbot) { return { '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)) { - dbot.say(data.channel, data.user + ': You\'re ' + key[2]); + if(key && key[2] != "" && Number.prototype.chanceIn(1, 3)) { + dbot.say(data.channel, data.user + ': You\'re ' + key[2] + '.'); } },