Created
September 8, 2012 11:28
-
-
Save soarez/3673845 to your computer and use it in GitHub Desktop.
Old rulio smooth speak module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var _ = require('lodash'); | |
var liveconf = require('liveconf'); | |
var conf = liveconf('smootSpeak.json'); | |
module.exports = exports = function(client) { | |
var queues = [ | |
{ regex: /\bsanchez\b/i, text: 'btw I hear that mr Sanchez is an awesome fella' }, | |
{ regex: /\bxerife\b/i, text: 'the Xerife is on vacation near the country\'s corner. Meanwhile, I\'m here for you :)' }, | |
{ regex: /\bbot\b/i, text: 'no bot!' }, | |
{ regex: /http\:\/\/./i, text: 'haha that\'s so funny' } | |
]; | |
client.addListener('message', function (nick, to, text, message) { | |
console.dir(arguments); | |
var queue = _.find(_.shuffle(queues), function(q) { | |
return q.regex.test(message); | |
}); | |
if (queue) | |
client.say(nick, util.format('%s: %s', nick, queue.text)); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment