Skip to content

Instantly share code, notes, and snippets.

@soarez
Created September 8, 2012 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soarez/3673845 to your computer and use it in GitHub Desktop.
Save soarez/3673845 to your computer and use it in GitHub Desktop.
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