I'm having a couple issues that I really do not understand; I haven't really done anything with javascript in years so I might just be missing something really simple but I have googled and googled and nothing.
var sys = require('util'),
irc = require('./lib/irc'),
pkgconfig = require('pkgconfig'),
winston = require('winston'),
argv = require('optimist').default('config', 'config').argv; // alternative: nconf
var confName = argv.config;
/**
* More advanced config
*
*
*
*/
var options = {
schema: 'config/schema.json',
config: 'config/' + confName + '.json'
};
var config = pkgconfig(options);
var bot = new irc.Client(config.server, config.botName, {
channels: config.channels
});
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: config.logLevel })
// new (winston.transports.File)({ level: config.logLevel, filename: 'ircbot.log' })
]
});
config.logger = logger;
/**
* Let's power up
*/
var ircClient = new irc.Server(config);
ircClient.connect();
//Listeners
bot.addListener('join', function (channel, who) {
// Welcome them in!
bot.say(channel, who + "Sup dude OneHand/");
});
That's my code; obviously I changed the password. Everytime I node the .js file it tells me that the bot part of bot.addListener is an unexpected identifier. Help?
EDIT: Fixed some of the obvious mess-ups. Still don't understand what's wrong
EDITEDIT: Completely revamped my code and now my issue is at line 31 and whenever I try to run it under node bot.js It tells me that I have a TypeError:Undefined is not a function and it points to the keyword new. Not exactly sure why that happens.