From dff4a1ffd7cf9ca3097ea0227a82d18184bbca25 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 4 Jun 2012 13:09:40 +0200 Subject: o Updating the atom plugin to the latest API. --- dynobot-irc.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'dynobot-irc.js') diff --git a/dynobot-irc.js b/dynobot-irc.js index 20f6f79..24dd2ee 100644 --- a/dynobot-irc.js +++ b/dynobot-irc.js @@ -74,7 +74,12 @@ var nick = 'dynobot'; var realName = 'bots\'r\'us'; var ident = 'ident'; -if(false) { +function info(a, b, c) { + console.log.apply(null, arguments); +} + +var reallyConnect = true; +if(reallyConnect) { irc = new IrcClient(nick, realName, ident, 'irc.freenode.net', 6667); } else { @@ -102,11 +107,12 @@ function Plugin(name, script) { } var plugins = [ - new Plugin('echo', './echo-bot/index.js') +// new Plugin('echo', './echo-bot/index.js') + new Plugin('atom', './atom-bot/index.js') ]; _.each(plugins, function(plugin) { - console.log('Starting ' + plugin.name); + info('Starting ' + plugin.name); // TODO: Resolve plugin.script // TODO: set cwd option to the plugin's directory. var args = []; @@ -117,7 +123,7 @@ _.each(plugins, function(plugin) { var channel = new Channel(child); ircService.handle(channel); child.on('exit', function() { - console.log(plugin.name + ' exited..'); + info(plugin.name + ' exited..'); ircService.release(channel); channel.close(); }); @@ -181,7 +187,7 @@ function setupRepl() { stdinPipe.send(':' + from + ' NOTICE ' + channel + ' :' + parts.join(' ')); } else { - console.log('You have to /j a channel first'); + info('You have to /j a channel first'); } break; default: @@ -196,10 +202,10 @@ function setupRepl() { } irc.join('#bitraf2', function(name) { - console.log('joined ' + name + ' from dynobot.'); + info('joined ' + name + ' from dynobot.'); }); -console.log('colors: ' + 'from bot'.red + ', ' + 'to bot'.blue); +info('colors: ' + 'from bot'.red + ', ' + 'to bot'.blue); irc.connect(); setupRepl(i); -- cgit v1.2.3