From 6896536a3b1c2946c2621369afd04c395d7b11aa Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 15 Jan 2013 15:43:02 +0000 Subject: [PATCH] redo youare [#131] --- modules/youare/youare.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/youare/youare.js b/modules/youare/youare.js index ddb25e0..89fa4f3 100644 --- a/modules/youare/youare.js +++ b/modules/youare/youare.js @@ -1,19 +1,17 @@ var youAre = function(dbot) { - return { - 'name': 'youare', - 'ignorable': false, + this.name = 'youare'; + this.ignorable = false; - 'listener': function(event) { - var key = event.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); + this.listener = function(event) { + var key = event.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); - if(key && key[2] != "" && Number.prototype.chanceIn(1, 100) && event.user != 'aisbot') { - event.reply(event.user + ': You\'re ' + key[2] + '.'); - } - }, - 'on': 'PRIVMSG' - }; + if(key && key[2] != "" && Number.prototype.chanceIn(1, 100) && event.user != 'aisbot') { + event.reply(event.user + ': You\'re ' + key[2] + '.'); + } + }.bind(this); + this.on = 'PRIVMSG'; }; exports.fetch = function(dbot) { - return youAre(dbot); + return new youAre(dbot); };