Skip to content

Instantly share code, notes, and snippets.

@adamtaylor
Created April 11, 2011 20:51
Show Gist options
  • Save adamtaylor/914312 to your computer and use it in GitHub Desktop.
Save adamtaylor/914312 to your computer and use it in GitHub Desktop.
node.js newbism
var jerk = require( 'jerk' ),
sys = require( 'sys' ),
sqlite = require( 'sqlite' );
var options = {
server: 'irc.freenode.net',
nick: 'Laurabelle',
channels: [ '#kkkk', ]
}
jerk( function( j ) {
//var db = new sqlite.Database();
j.watch_for( 'soup', function( message ) {
message.say( message.user + ': soup is good food!' )
})
j.watch_for( /^(.+) is (.*)/, function( message ) {
message.say( 'Okay, ' + message.user + ': ' + message.match_data[1] + ' is ' + message.match_data[2] )
})
//db.open("info.db", function (error) {
//if (error) {
//throw error;
//}
//db.execute(
//"INSERT INTO factoids (thing,fact) VALUES (?,?)",
//[message.match_data[1], message.match_data[2]],
//function (error, rows) {
//if (error) throw error;
//}
//);
//});
}).connect( options )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment