Skip to content

Instantly share code, notes, and snippets.

@soarez
Created Sep 8, 2012
Embed
What would you like to do?
Old rulio smooth speak module
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